Re: yet another regex



On 5/11/07, Steve Finkelstein <sf@xxxxxxxxxxxxx> wrote:
Oh, so it goes through each and every character in the original string
passed. I thought it takes in the string as one entity and just captures
the first digit it can.

Does -p make it iterate over each character?

No, the -ple causes it to write the code like this:

$\ = $/;
LOOP:
WHILE (<>) {
s/|(\d)|length(9 x $1)|eg;
}

The g on the end of the regex causes it to apply the pattern multiple
times. The e on the end of the regex makes it treat the replacement
like code instead of a string.
.



Relevant Pages

  • Re: Regular expression captures
    ... > From the following string I would like to capture text. ... This action has been executed via Console ... > the RegEx class but I'm having troubles retrieving "Console". ... The captures will always include the substring that matches the whole ...
    (microsoft.public.dotnet.framework)
  • Re: yet another regex
    ... Steve Finkelstein wrote: ... I thought it takes in the string as one entity and just captures ... the first digit it can. ...
    (perl.beginners)
  • Re: Fastest way to search a string for the occurance of a word??
    ... but the OP's question was what's the "Fastest way to search a string ... in all the tests I did here, the Regex was by far superior. ... However, of course, if you've got new regular expressions all ... Sure - but just that extra Match object could be relevant if the search ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: regular expression help
    ... Basically because if you remove everything that is optional in the regex below you end up with an empty regex: ... So the regex engine will try to match on every character in the string: ... , comma doesn't match, but the nothingness in front of it does. ... A quote followed by any sequence of characters that is not a quote, ...
    (microsoft.public.dotnet.framework)
  • Re: Regex optimization
    ... I was hoping that someone with knowledge of the Regex engine could ... match per string for either Regex. ... reluctant modifier, may be slower .*?, +? ... Variable parts will try to capture as much as possible. ...
    (microsoft.public.dotnet.languages.csharp)

Loading