Re: numbers and strings and regex?



On Mon, 30 May 2005 18:30:42 +0100, Brian McCauley <nobull@xxxxxxxx>
wrote:

>You you appear to be delaring $esnum in the wrong place.
>
>I also suspect you be anchoring your regex to the end of the string
>raher than using .* to find the last match.
>
>Perhaps you should try something simple like...
>
> if ($name =~ /\d{2}-(\d{2})\.jmx$/i) {
> my $exnum = 0+$1;
> }

Thanks Brian - will try that and get back.

Cheers

Geoff

.



Relevant Pages

  • Re: numbers and strings and regex?
    ... I also suspect you be anchoring your regex to the end of the string ... my $exnum = 0+$1;}. ...
    (comp.lang.perl.misc)
  • 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)
  • Re: [Slightly OT] Case against ".*" regexp
    ... string and I guess you would say the match is pretty pointless. ... people use .* rather than spending the time to analyse the real patterns ... Anchoring to the beginning/end of the string ... Think about ways to give the regexp engine as many clues or as much ...
    (comp.lang.ruby)