Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Regex: Matching around a word(s)

by wolfger (Deacon)
on Dec 20, 2005 at 19:10 UTC ( [id://518157]=note: print w/replies, xml ) Need Help??


in reply to Regex: Matching around a word(s)

Edit: Ignore me please... I need to read the problem completely before whipping out code that doesn't work.

#!/usr/bin/perl use strict; use warnings; my $string = "This is just and example text string to test our regex. +Please ignore it."; my $wordpadding = 2; my $searchword = "test"; $string =~ /((\w+\W+?){$wordpadding}$searchword(\W+?\w+){$wordpadding} +)/; print $1;

jdporter unconsidered. Considered by wolfger: "please delete. I hit send before fully reading/understanding the problem." Final tally: 8 keep, 11 reap.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-25 13:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found