Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^3: One regex construct to handle multiple string types

by ww (Archbishop)
on Nov 29, 2008 at 12:34 UTC ( #726772=note: print w/replies, xml ) Need Help??

in reply to Re^2: One regex construct to handle multiple string types
in thread One regex construct to handle multiple string types

Precise definition depends on the language.

Mastering Regular Expressions, 2nd Ed., Jeffery E. F. Friedll, published by O'Reilly characterizes\w in its "Common Metacharacters..." chapter, this way:

Part-of_word character   Often the same as [a-zA-Z0-9_], although some ools omit the underscore, while others include all the extraalphanumerics characters in the locale. If Unicode is supported, \w usually refers to all alphanumerics (notable exception: Sun's Java regex package whose \w is exactly [a-zA-Z0-9_</c>).
Regular Expressions Pocket Reference (also from O'Reilly) defines \w as:
  • \p{IsWord} for Perl
  • and as [A-Za-z0-9_] for Java.

Regretably, the definition of \p{isWord} -- [_\p{L1}\p{Lu}\p{Lt}\p{Lo}\p{Nd} -- is, for me, almost impenetrable but Friedll's characterization may be as good as you'll get without deep study of perlretut and friends.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2023-10-03 07:32 GMT
Find Nodes?
    Voting Booth?

    No recent polls found