Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Matching set of paragraph tags with string inside.

by the_0ne (Pilgrim)
on Feb 08, 2008 at 21:02 UTC ( #667067=note: print w/replies, xml ) Need Help??


in reply to Re: Matching set of paragraph tags with string inside.
in thread Matching set of paragraph tags with string inside.

My problem with the first match is it matches too much...
original: "<p>no tabs here</p><p>column 1[tab]column 2</p><p>no tabs here</p>" result of first regex: no tabs here</p><p>column 1[tab]column 2
What I want it to match is...
column 1[tab]column 2
Since that is the set of para's with the string [tab].

Replies are listed 'Best First'.
Re^3: Matching set of paragraph tags with string inside.
by moritz (Cardinal) on Feb 08, 2008 at 21:20 UTC
    My first shot was too fast, here's a working solution:
    my $contents = "<p>no tabs here</p><p>column 1[tab]column 2</p><p>no t +abs here</p>"; if ($contents =~ m{(<p>[^<>]*\[tab\][^<>]*</p>)} ){ print "Matched '$1'\n;"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://667067]
help
Chatterbox?
[Lady_Aleena]: SOB! Now I'm really trying to get qx(mp3info -p "%S" $file) but the spaces in the filenames are kicking my butt.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-04-23 23:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (433 votes). Check out past polls.