SEARCH RESULTS

FAQ

"How can I do approximate matching?" in perlfaq6

How can I do approximate matching? See the module String::Approx available from CPAN.

"How do I match a regular expression that's in a variable?" in perlfaq6

How do I match a regular expression that's in a variable? ... Once you have the pattern in $regex, you use that variable in the match operator.

"Can I use Perl regular expressions to match balanced text?" in perlfaq6

Each time you get a balanced match, remove its outer delimiter (that's the one you just matched so don't ... The outermost matches show up first and the nested matches show up later: Found: <brackets

"How do I find matching/nesting anything?" in perlfaq4

How do I find matching/nesting anything?

"How can I make \w match national character sets?" in perlfaq6

How can I make \w match national character sets? Put use locale; in your script.

"How do I efficiently match many regular expressions at once?" in perlfaq6

How do I efficiently match many regular expressions at once? ... contributed by brian d foy) You want to avoid compiling a regular expression every time you want to match

"How can I match a locale-smart version of /[a-zA-Z]/?" in perlfaq6

How can I match a locale-smart version of /[a-zA-Z]/?

"How can I match strings with multibyte characters?" in perlfaq6

How can I match strings with multibyte characters?

"I'm having trouble matching over more than one line. What's wrong?" in perlfaq6

I'm having trouble matching over more than one line. What's wrong? ... or both) you might want to use: /s allows dot to include newline, and /m allows caret and dollar to match

"How do I match XML, HTML, or other nasty, ugly things with a regex?" in perlfaq6

How do I match XML, HTML, or other nasty, ugly things with a regex? Do not use regexes.

"What good is \G in a regular expression?" in perlfaq6

Subsequent matches start where the last successful match ended (the value of pos()) even if a match on ... match).

"How do I strip blank space from the beginning/end of a string?" in perlfaq4

Remember, the trailing newline matches the \s+, and the $ anchor can match to the absolute end of the ... Instead of matching any whitespace (since that includes a newline), just match the other whitespace:

"Why don't word-boundary searches with \b work for me?" in perlfaq6

These strings match /\bPerl\b/. ... These strings match the pattern /\b'\b/.

"Why does using $&, $`, or $' slow my program down?" in perlfaq6

That means that on every pattern match the entire string will be copied, part of it to $`, part to $& ... Thus the penalty is most severe with long strings and patterns that match often.

"What does it mean that regexes are greedy? How can I get around it?" in perlfaq6

Most people mean that greedy regexes match as much as they can. ... quantifier effectively tells the regular expression engine to find a match as quickly as possible and

"How can I quote a variable to use in a regex?" in perlfaq6

Octopus" Because . is special in regular expressions, and can match any single character, the regex ... P. here has matched the <Pl> in the original string.

"How can I count the number of occurrences of a substring within a string?" in perlfaq4

What you can do is wrap a while() loop around a global pattern match. ... in list context, then assigns the result to a scalar, producing a count of the number of matches.

"How do I find the soundex value of a string?" in perlfaq4

If you want to do fuzzy or close matching, you might also try the String::Approx, and Text::Metaphone

"How can I tell whether a certain element is contained in a list or array?" in perlfaq4

This does have the benefit of telling you how many matches it found, though. ... my @matches = grep $_ eq $whatever, @array;

"How can I pass/return a {Function, FileHandle, Array, Hash, Method, Regex}?" in perlfaq7

Passing Regexes Here's an example of how to pass in a string and a regular expression for it to match ... my ($val1, $regex) = @_; my $retval = $val1 =~ /$regex/; return $retval; } $match

More results found. Refine your search terms or show all FAQ results.

Functions

match failure, but can also be because no match has yet been run on the scalar). ... the current match, such as in (?

split - split up a string using a regexp delimiter

If PATTERN matches the empty string, the EXPR is split at the match position (between characters). ... As a special case for split, the empty pattern given in match operator syntax (//) specifically matches

m//

m// The match operator. See "Regexp Quote-Like Operators" in perlop.

defined - test whether a value, variable, or function is defined

.*)b/; The pattern match succeeds and $1 is defined, although it matched "nothing". ... It didn't really fail to match anything.

reset - clear all variables of a given name

If the expression is omitted, one-match searches (m?pattern?) are reset to match again.

glob - expand filenames using wildcards

As such, glob("*.c *.h") matches all files with a .c or .h extension. ... .* *") matches all files in the current working directory.

study - no-op, formerly optimized input data for repeated searches

When matching a pattern, the rarest character from the pattern would be looked up in this index.

index - find a substring within a string

string within another, but without the wildcard-like behavior of a full regular-expression pattern match

waitpid - wait for a particular child process to die

A non-blocking wait (with WNOHANG in FLAGS) can return 0 if there are child processes matching PID but

quotemeta - quote regular expression magic characters

(That is, all ASCII characters not matching /[A-Za-z_0-9]/ will be preceded by a backslash in the returned ... (Not all the code points that match Pattern_Syntax have actually had characters assigned to them; so

crypt - one-way passwd-style encryption

If the two digests match, the password is correct.

binmode - prepare binary files for I/O

On many operating systems, the native text file representation matches the internal representation, but

die - raise an exception or bail out

Such a scheme is sometimes preferable to matching particular string values of $@ with regular expressions

require - load in external functions from a library at runtime

If an empty list, undef, or nothing that matches the first 3 values above is returned, then require looks

open - open a file, pipe, or descriptor

The mode you specify should match the mode of the original filehandle.

pack - convert a list into a binary representation

to improve legibility and maintainability of pack/unpack formats as /x can for complicated pattern matches

Documentation

CPAN::Distroprefs - CPAN::Distroprefs -- read and match distroprefs

true if this pref has a 'match' attribute and at least one valid match attribute matches if ($pref ... ->matches(\%arg)) { ... } true if this pref matches the passed-in hashref, which must have a value for

ptargrep - Apply pattern matching to the contents of files in a tar archive

--list-only|-l list matching filenames rather than extracting matches --verbose|-v write debugging ... --ignore-case (alias -i) Make pattern matching case-insensitive.

File::Glob - Perl extension for BSD glob routine

Ordinarily bsd_glob() continues to find matches. ... However, this does not match "normal practice" on these systems.

Perl::OSType - Map Perl operating system names to generic types

DESCRIPTION Modules that provide OS-specific behaviors often need to know if the current operating system matches

perlrequick - Perl regular expressions quick start

for a match. ... "Hello World" =~ m{World}; # matches, note the matching '{}' "/usr/bin/perl" =~ m"/perl"; # matches

perlretut - Perl regular expressions tutorial

match "Hello World" =~ /o W/; # matches "Hello World" =~ /oW/; # doesn't match "Hello World" ... matches "\n" $x =~ /girl.Who/m; # doesn't match, "." doesn't match "\n" $x =~ /girl.Who/sm; # matches

perlrecharclass - Perl Regular Expression Character Classes

match (dot has to match a character) "\n" =~ /./ # No match (dot does not match a newline) "\ ... Any character not matched by \d is matched by \D.

perlre - Perl regular expressions

Match 1 or 0 times {n} Match exactly n times {n,} Match at least n times {,n} Match ... match to the "worst" match, and it is the "best" match which is chosen.

perlreref - Perl Regular Expressions Reference

only aa (two a's) also /i matches exclude ASCII/non-ASCII l match according to current locale u match ... prior to matched string ${^MATCH} Entire matched string ${^POSTMATCH} Everything after to matched

perlrebackslash - Perl Regular Expression Backslash Sequences and Escapes

"cat\n" =~ /cat\Z/; # Match. "cat\n" =~ /cat\z/; # No match. ... "cat" =~ /\bcat\B/; # No match. "cats" =~ /\bcat\B/; # Match.

perldebguts - Guts of Perl debugging

some already matched string REFF num 1 Match already matched string, using /di ... REFFU num 1 Match already matched string, usng /ui.

perlunicode - Unicode support in Perl

None are considered to match \w for example, but all match \W. ... Thus both these match: "0" =~ /\p{sc=Common}/ # Matches "0" =~ /\p{scx=Common}/ # Matches and

perlembed - how to embed perl in your C program

\n\n"); /** Match all occurrences of /wi../ **/ num_matches = matches(text, "m/(wi..) ... /g", &match_list); printf("matches: m/(wi..)/g found %d matches...

Text::Balanced - Extract delimited text sequences from strings.

No match found for opening bracket extract_codeblock failed to find a closing bracket to match the ... tried to modify the matched text to produce a matching closing tag (because none was specified).

re - Perl pragma to alter regular expression behaviour

MATCH Turns on debugging of the main matching loop. ... BUFFERS Enable debugging the capture group storage during match.

perlreapi - Perl regular expression plugin interface

Arguments: rx: the regex to match against sv: the SV being matched: only used for utf8 flag; ... would allow a match.

File::GlobMapper - Extend File Glob to Allow Input and Output Files

Matches a literal '.'. Equivalent to the Perl regular expression \. ... * Matches zero or more characters, except '/'.

Unicode::Collate - Unicode Collation Algorithm

$match_ref = $Collator->match($string, $substring) ($match) = $Collator->match($string, $substring ... if ($match_ref = $Collator->match($str, $sub)) { # scalar context print "matches [$$match_ref].

Net::NNTP - NNTP Client class

shell matches filenames. ... There are five pattern matching operations other than a strict one-to-one match between the pattern and

autodie::exception - Exceptions from autodying functions.

matches if ( $e->matches('open') ) { ... } if ( 'open' ~~ $e ) { ... } matches is used to determine ... On Perl 5.10 and above, using smart-match (~~) with an autodie::exception object will use matches underneath

More results found. Refine your search terms or show all documentation results.

Perldeltas

"Smart match changes" in perl5120delta

Smart match changes Since Perl 5.10.0, Perl's developers have made a number of changes to the smart ... match operator.

"Smart match changes" in perl5101delta

Smart match changes Changes to type-based dispatch The smart match operator ~~ is no longer commutative ... The full dispatch table for the smart match operator is given in "Smart matching in detail" in perlsyn

"Smart match and overloading" in perl5101delta

Smart match and overloading According to the rule of dispatch based on the rightmost argument type, ... Thus, writers of overloading routines for smart match mostly need to worry only with comparing against

"Smart match and overloading" in perl5120delta

Smart match and overloading According to the rule of dispatch based on the rightmost argument type, ... This way, distributivity of smart match across arrays is not broken, as well as the other behaviours

"Switch and Smart Match operator" in perl5100delta

Switch and Smart Match operator Perl 5 now has a switch statement. ... This kind of match is called smart match, and it's also possible to use it outside of switch statements

"Character matching routines in POSIX" in perl5200delta

Character matching routines in POSIX Use of any of these functions in the POSIX module is now deprecated

"Smart-matching against array slices" in perl5140delta

Smart-matching against array slices Previously, the following code resulted in a successful match:

"Most \p{} properties are now immune to case-insensitive matching" in perl5140delta

make sense to have them match differently under /i case-insensitive matching. ... Now matching under /i gives the same results as non-/i matching except for those few properties where

"\N{...} can now have Unicode loose name matching" in perl5160delta

\N{...} can now have Unicode loose name matching This is described in the charnames item in "Updated

"@- and @+ provide starting/ending offsets of regex matches" in perl56delta

@- and @+ provide starting/ending offsets of regex matches The new magic variables @- and @+ provide

"\p{}, \P{} matching has changed for non-Unicode code points." in perl5200delta

\p{}, \P{} matching has changed for non-Unicode code points. ... Their behavior on matching these legal Unicode code points is unchanged, but there are changes for code

"\p{All} has been expanded to match all possible code points" in perl5200delta

\p{All} has been expanded to match all possible code points The Perl-defined regular expression pattern ... element \p{All}, unused on CPAN, used to match just the Unicode code points; now it matches all possible

"New Restrictions in Multi-Character Case-Insensitive Matching in Regular Expression Bracketed Character Classes" in perl5180delta

New Restrictions in Multi-Character Case-Insensitive Matching in Regular Expression Bracketed Character ... People were specifying things such as /[\0-\xff]/i, and being surprised that it matches the two character

"Limited variable length lookbehind in regular expression pattern matching is now experimentally supported" in perl5300delta

Core Enhancements Limited variable length lookbehind in regular expression pattern matching is now experimentally

"Certain pattern matching features are now prohibited in compiling Unicode property value wildcard subpatterns" in perl5320delta

Incompatible Changes Certain pattern matching features are now prohibited in compiling Unicode property

"Regular Expressions and String Escapes" in perl5140delta

One example is LATIN SMALL LETTER SHARP S which matches the sequence ss. ... This should match any sequences of characters that aren't the SHARP S nor what SHARP S matches under

"Inverted bracketed character classes and multi-character folds" in perl5140delta

One example is LATIN SMALL LETTER SHARP S which matches the sequence ss. ... This should match any sequences of characters that aren't the SHARP S nor what SHARP S matches under

"Bug Fixes" in perl5143delta

-1 character precedes a character in the string that should match the pattern. ... This caused matches such as "f\x{FB00}" =~ /ff/i to fail.

"Variable length lookbehind is mostly no longer considered experimental" in perl5360delta

<=(a|aa))/ should match and leave $1 equaling "a" or "aa". ... that we will keep the current "longest match" behavior.

"\N experimental regex escape" in perl5120delta

single line match modifier /s. ... \N{3} means to match 3 non-newlines; \N{5,} means to match at least 5.

More results found. Refine your search terms or show all perldelta results.