Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 avoiding work at the Monastery: (6)
As of 2015-07-05 00:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls