"be consistent" | |
PerlMonks |
Regex for ignoring pathsby Amblikai (Scribe) |
on Oct 31, 2018 at 11:12 UTC ( [id://1224976]=perlquestion: print w/replies, xml ) | Need Help?? |
Amblikai has asked for the wisdom of the Perl Monks concerning the following question: Hi Monks, i'm having a problem coming up with a nice regex for a quick script i'm writing Essentially i'm parsing a file for certain pieces of information, and contained in the file is a unix path which triggers my regex probably best explained with simplified code:
Which obviously gives me:
The problem i have is that i'd like to only pick up "word.other" I've tried: /(?<!\/)(\w+\.\w+) but that just (rightly) gives me "ord.other" and "oo.baz" etc Obviously i could strip out the paths first etc but it seems like there should be a nice way to do it in a regex, i just can't think of one. Any thoughts? Thanks!
Back to
Seekers of Perl Wisdom
|
|