Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-05-28 10:15 GMT
Find Nodes?
    Voting Booth?