This subset looks safe enough:

. Matches any single character (many applications exclude newlines, and
exactly which characters are considered newlines is flavor, character
encoding, and platform specific, but it is safe to assume that the line feed
character is included). Within POSIX bracket expressions, the dot character
matches a literal dot. For example, a.c matches "*abc*", etc., but
[a.c]matches only "
*a*", "*.*", or "*c*".  [ ] A bracket expression. Matches a single character
that is contained within the brackets. For example, [abc] matches "*a*", "*b
*", or "*c*". [a-z] specifies a range which matches any lowercase letter
from "*a*" to "*z*". These forms can be mixed: [abcx-z] matches "*a*", "*b*",
"*c*", "*x*", "*y*", or "*z*", as does [a-cx-z].

The - character is treated as a literal character if it is the last or the
first character within the brackets, or if it is escaped with a backslash:
[abc-], [-abc], or [a\-bc].
  [^ ] Matches a single character that is not contained within the brackets.
For example, [^abc] matches any character other than "*a*", "*b*", or "*c*".
[^a-z] matches any single character that is not a lowercase letter from "*a*"
to "*z*". As above, literal characters and ranges can be mixed.  ^ Matches
the starting position within the string. In line-based tools, it matches the
starting position of any line.  $ Matches the ending position of the string
or the position just before a string-ending newline. In line-based tools, it
matches the ending position of any line.  \( \) Defines a marked
subexpression. The string matched within the parentheses can be recalled
later (see the next entry, \*n*). A marked subexpression is also called a
block or capturing group.  \*n* Matches what the *n*th marked subexpression
matched, where *n* is a digit from 1 to 9. This construct is theoretically *
irregular* and was not adopted in the POSIX ERE syntax. Some tools allow
referencing more than nine capturing groups.  * Matches the preceding
element zero or more times. For example, ab*c matches "*ac*", "*abc*", "*
abbbc*", etc. [xyz]* matches "", "*x*", "*y*", "*z*", "*zx*", "*zyx*", "*
xyzzy*", and so on. \(ab\)* matches "", "*ab*", "*abab*", "*ababab*", and so
on.  \{*m*,*n*\} Matches the preceding element at least *m* and not more
than *n* times. For example, a\{3,5\} matches only "*aaa*", "*aaaa*", and "*
aaaaa*". This is not found in a few, older instances of regular expressions.

*Examples:*

   - .at matches any three-character string ending with "at", including "*
   hat*", "*cat*", and "*bat*".
   - [hc]at matches "*hat*" and "*cat*".
   - [^b]at matches all strings matched by .at except "*bat*".
   - ^[hc]at matches "*hat*" and "*cat*", but only at the beginning of the
   string or line.
   - [hc]at$ matches "*hat*" and "*cat*", but only at the end of the string
   or line.



On Tue, Jan 6, 2009 at 1:00 PM, Martin Davis <mbda...@refractions.net>wrote:

> It looks to me like the syntax for the POSIX character classes is
> different on the Wikipedia article to the Java Pattern class.  8^(
> (You know what they say about standards...)
>
> These are quite useful, so this could be important to note.
>
> Larry Becker wrote:
> > I like the "POSIX Basic Regular Expressions" section of the Wikipedia
> > article.  Still not for the feint-of-heart.
> >
> >
> > On Tue, Jan 6, 2009 at 12:08 PM, Martin Davis <mbda...@refractions.net
> > <mailto:mbda...@refractions.net>> wrote:
> >
> >     Check these out:
> >
> >
> http://leepoint.net/notes-java/data/strings/40regular_expressions/05regex.html
> >     http://en.wikipedia.org/wiki/Regular_expression
> >
> >
> >     Martin Davis wrote:
> >     > Yes, that would be nice.  The Pattern language is *very*
> >     powerful, but
> >     > *very* complex too.
> >     >
> >     > Hmm... there's a book in there I think - or at least a nice
> website.
> >     >
> >     > The language I think follows most common conventions for regex
> >     languages
> >     > - and I'm pretty sure there's some good general references out
> >     there.
> >     > I'll post if I find one.
> >     >
> >     > I use this a lot in JEQL scripts - so it would be nice to have a
> >     > reference site for that too.
> >     >
> >     > Larry Becker wrote:
> >     >
> >     >> That's it.  I've looked for a better (more user oriented)
> >     reference,
> >     >> but never found one.
> >     >>
> >     >> Larry
> >     >>
> >     >> On Tue, Jan 6, 2009 at 12:00 PM, Martin Davis
> >     <mbda...@refractions.net <mailto:mbda...@refractions.net>
> >     >> <mailto:mbda...@refractions.net
> >     <mailto:mbda...@refractions.net>>> wrote:
> >     >>
> >     >>     Perhaps
> >     >>
> >     >>
> >     http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
> >     >>
> >     >>     ??
> >     >>
> >     >>     Stefan Steiniger wrote:
> >     >>     >
> >     >>     >> By the way, since it uses the Java pattern matcher,
> >     Search All
> >     >>     >> Attributes supports many different meta-characters to
> >     control
> >     >>     the search
> >     >>     >> such as ^ to match the start of a line and $ to match
> >     the end.
> >     >>     >>
> >     >>     > oha..interesting.. how to get to know these chars?
> >     >>     > is there a table?
> >     >>     >
> >     >>     > stefan
> >     >>     >
> >     >>     >
> >     >>
> >
> ------------------------------------------------------------------------------
> >     >>     > Check out the new SourceForge.net Marketplace.
> >     >>     > It is the best place to buy or sell services for
> >     >>     > just about anything Open Source.
> >     >>     > http://p.sf.net/sfu/Xq1LFB
> >     >>     > _______________________________________________
> >     >>     > Jump-pilot-devel mailing list
> >     >>     > Jump-pilot-devel@lists.sourceforge.net
> >     <mailto:Jump-pilot-devel@lists.sourceforge.net>
> >     >>     <mailto:Jump-pilot-devel@lists.sourceforge.net
> >     <mailto:Jump-pilot-devel@lists.sourceforge.net>>
> >     >>     >
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >     >>     >
> >     >>     >
> >     >>
> >     >>     --
> >     >>     Martin Davis
> >     >>     Senior Technical Architect
> >     >>     Refractions Research, Inc.
> >     >>     (250) 383-3022
> >     >>
> >     >>
> >     >>
> >
> ------------------------------------------------------------------------------
> >     >>     Check out the new SourceForge.net Marketplace.
> >     >>     It is the best place to buy or sell services for
> >     >>     just about anything Open Source.
> >     >>     http://p.sf.net/sfu/Xq1LFB
> >     >>     _______________________________________________
> >     >>     Jump-pilot-devel mailing list
> >     >>     Jump-pilot-devel@lists.sourceforge.net
> >     <mailto:Jump-pilot-devel@lists.sourceforge.net>
> >     >>     <mailto:Jump-pilot-devel@lists.sourceforge.net
> >     <mailto:Jump-pilot-devel@lists.sourceforge.net>>
> >     >>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >     >>
> >     >>
> >     >>
> >     >>
> >     >> --
> >     >> http://amusingprogrammer.blogspot.com/
> >     >>
> >
> ------------------------------------------------------------------------
> >     >>
> >     >>
> >
> ------------------------------------------------------------------------------
> >     >> Check out the new SourceForge.net Marketplace.
> >     >> It is the best place to buy or sell services for
> >     >> just about anything Open Source.
> >     >> http://p.sf.net/sfu/Xq1LFB
> >     >>
> >
> ------------------------------------------------------------------------
> >     >>
> >     >> _______________________________________________
> >     >> Jump-pilot-devel mailing list
> >     >> Jump-pilot-devel@lists.sourceforge.net
> >     <mailto:Jump-pilot-devel@lists.sourceforge.net>
> >     >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >     >>
> >     >>
> >     >
> >     >
> >
> >     --
> >     Martin Davis
> >     Senior Technical Architect
> >     Refractions Research, Inc.
> >     (250) 383-3022
> >
> >
> >
> ------------------------------------------------------------------------------
> >     Check out the new SourceForge.net Marketplace.
> >     It is the best place to buy or sell services for
> >     just about anything Open Source.
> >     http://p.sf.net/sfu/Xq1LFB
> >     _______________________________________________
> >     Jump-pilot-devel mailing list
> >     Jump-pilot-devel@lists.sourceforge.net
> >     <mailto:Jump-pilot-devel@lists.sourceforge.net>
> >     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
> >
> >
> >
> > --
> > http://amusingprogrammer.blogspot.com/
> > ------------------------------------------------------------------------
> >
> >
> ------------------------------------------------------------------------------
> > Check out the new SourceForge.net Marketplace.
> > It is the best place to buy or sell services for
> > just about anything Open Source.
> > http://p.sf.net/sfu/Xq1LFB
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
>
> --
> Martin Davis
> Senior Technical Architect
> Refractions Research, Inc.
> (250) 383-3022
>
>
>
> ------------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It is the best place to buy or sell services for
> just about anything Open Source.
> http://p.sf.net/sfu/Xq1LFB
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>



-- 
http://amusingprogrammer.blogspot.com/
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to