Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: regex search

by muba (Priest)
on Jun 19, 2012 at 19:10 UTC ( #977138=note: print w/replies, xml ) Need Help??

in reply to regex search

Given that AnomalousMonk's response above doesn't answer your question, I think I get you now. What you're trying to achieve, actually, is this: you have a situation, in which you have these set of strings:

my $superstring = "123abc.def.ghi"; my $substring = "abc.def.ghi"; my $prefix = "123";

And what you want to do is to see whether $substring appears in $superstring, but only if it's preceded by $prefix?

Like this?

#### (pfff where is my head at. This won't work of course) $superstrin +g =~ m/$B$A/ $superstring =~ m/$prefix$superstring/;

If that's not it, then you'll have to explain what you mean with 'prefix' in this context.

Edit:Caught a stupid brainfail in the regex code. Fixed.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://977138]
[Corion]: dazz: BTW, the following should work (no Image::Magick installed, so untested): open(my $fh, '<', \$jpegbuffer); $image->Read(file= > $fh);
[choroba]: Hm, it seems my humble contributions to CPAN pass their test suites with the PERL5OPT set

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2017-03-27 08:12 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (317 votes). Check out past polls.