[thelist] regexp help

AxssDnied axssdnied at borg.darktech.org
Mon Jul 14 11:51:00 CDT 2003


how about: /04([^|]{0,4096})\|/   ??

hmm, you'll notice I used {0,4096} rather then * ... simply a matter of
not letting your code affected by overly long strings... 4kB should be
long enough for a lot of applications... turn it into * if you think you
have to handle unreasonably long strings.

Hope this helps,
Andrew

> Hi,
> I have a long string that I'm parsing in Perl, like this:
>
>  11 aaa| 2355 bbbb| 04 aff gge|...
>
> When I search for 04 I want to get the value 'aff gge' in a variable
>
> So far I'm trying like this, but it's not returning the correct string:
>
> if($string=~/04(.*?)\|/gi){
>     $substring=$1;
> }
>
> Any ideas?
>
> Richard.
> --
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> Evolt.org conference in London, July 25-27 2003.  Register today at
> http://evolt.org.uk
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>



More information about the thelist mailing list