Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Excluding Words in RegEx

by ramprasad27 (Sexton)
on Nov 06, 2011 at 07:02 UTC ( [id://936245]=note: print w/replies, xml ) Need Help??


in reply to Re: Excluding Words in RegEx
in thread Excluding Words in RegEx

should we need to escape . ?

/^(?!.*\bgroup\b)(\d{4}) (^.+?.\!\?)$/

is good enough? \. and . does the same thing? any takers?

Replies are listed 'Best First'.
Re^3: Excluding Words in RegEx
by Lotus1 (Vicar) on Nov 06, 2011 at 16:04 UTC

    Good point that within a character class '.' does not need to be escaped with a backslash. However, you need to use <code></code> tags around it in your post so the [] aren't rendered as links.

Re^3: Excluding Words in RegEx
by ikegami (Patriarch) on Nov 07, 2011 at 04:35 UTC
    I just copied the OP's pattern. But yeah,
    /^(\d{4}) ([^\.]+?[\.\!\?])$/

    can be shortened to

    /^(\d{4}) ([^.]+?[.!?])$/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-23 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found