Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Character class set operations?

by diotalevi (Canon)
on Oct 23, 2007 at 03:26 UTC ( #646635=perlquestion: print w/replies, xml ) Need Help??

diotalevi has asked for the wisdom of the Perl Monks concerning the following question:

I recall discussion of a feature in the regexp engine supporting set operations on character classes. I would like to use the character class [[:punct:]] minus [,"\s]. Isn't there a syntax to support that directly? I can't recall it and can't find documentation to support it. Whatever happened to that?

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Replies are listed 'Best First'.
Re: Character class set operations? (^..^)
by tye (Sage) on Oct 23, 2007 at 03:32 UTC
    [^[:^punct:],"\s]

    Update: [:punct:] doesn't include any whitespace characters (in my testing) so your request to exclude \s and my \s are likely superfluous, FYI.

    - tye        

Re: Character class set operations?
by ysth (Canon) on Oct 23, 2007 at 04:18 UTC
    and the documentation is in perlre just after the list of character class names:
    You can negate the [::] character classes by prefixing the class name with a ^. This is a Perl extension.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://646635]
Approved by GrandFather
Front-paged by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2020-10-29 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (269 votes). Check out past polls.

    Notices?