Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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.


Comment on Re: regex search
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://977138]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-08-23 09:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (173 votes), past polls