Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #22238

Re: regex reserved chars

From markspace <markspace@nospam.nospam>
Newsgroups comp.lang.java.programmer
Subject Re: regex reserved chars
Date 2013-02-08 19:02 -0800
Organization A noiseless patient Spider
Message-ID <kf4e7i$3ps$1@dont-email.me> (permalink)
References <42t5h8d8ta5iq9nkfded0pvfl104cqhc77@4ax.com> <511300de$0$295$14726298@news.sunsite.dk> <kf15kg$g9o$1@localhost.localdomain> <5115a135$0$288$14726298@news.sunsite.dk>

Show all headers | View raw


On 2/8/2013 5:06 PM, Arne Vajhøj wrote:

> On 2/7/2013 4:17 PM, Martin Gregorie wrote:
>> That's normally the first place I look, but it doesn't answer Roedy's
>> question -

>
> Actually it does explain that the special characters are different
> inside and outside.
>
...
> It did not answer the next question: what is the special
> characters inside.

I had to double-check this myself, but it does indeed answer the 
question.  The section on character classes lists all the special 
character classes;  they even order them by precedence for you.

They are:

1. Literal escape: \
2. Grouping: []
3. Range: - (as in a-z)
4. Union (implicit): [a-e][i-o]
5. Intersection: &&

That's it.  The "note" there just to remind you that this list is in 
fact distinct from the previous meta characters.  (It appears to me that 
^ actually makes a separate token with [, [^, which is different from 
the non-negated character class.  That's why you can use ^ anywhere 
within the character class except the first position.)

And BTW, by "double check," I mean I read the Pattern Java docs page. 
That's also a skill any programmer should have: reading.  All the docs, 
to the end.  It's just something you have to do.



Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

regex reserved chars Roedy Green <see_website@mindprod.com.invalid> - 2013-02-06 16:28 -0800
  Re: regex reserved chars markspace <markspace@nospam.nospam> - 2013-02-06 16:54 -0800
    Re: regex reserved chars Lew <lewbloch@gmail.com> - 2013-02-06 18:03 -0800
      Re: regex reserved chars markspace <markspace@nospam.nospam> - 2013-02-06 18:10 -0800
        Re: regex reserved chars Roedy Green <see_website@mindprod.com.invalid> - 2013-02-06 22:50 -0800
          Re: regex reserved chars markspace <markspace@nospam.nospam> - 2013-02-07 09:32 -0800
            Re: regex reserved chars Gene Wirchenko <genew@telus.net> - 2013-02-07 10:51 -0800
              Re: regex reserved chars markspace <markspace@nospam.nospam> - 2013-02-07 11:53 -0800
              Re: regex reserved chars Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 20:25 -0500
              Re: regex reserved chars Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 20:32 -0500
          Re: regex reserved chars Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 20:17 -0500
      Re: regex reserved chars Roedy Green <see_website@mindprod.com.invalid> - 2013-02-06 23:06 -0800
        Re: regex reserved chars Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 20:15 -0500
          Re: regex reserved chars Lew <lewbloch@gmail.com> - 2013-02-09 10:43 -0800
  Re: regex reserved chars Arne Vajhøj <arne@vajhoej.dk> - 2013-02-06 20:18 -0500
    Re: regex reserved chars Martin Gregorie <martin@address-in-sig.invalid> - 2013-02-07 21:17 +0000
      Re: regex reserved chars Jim Janney <jjanney@shell.xmission.com> - 2013-02-07 20:47 -0700
        Re: regex reserved chars Martin Gregorie <martin@address-in-sig.invalid> - 2013-02-09 00:50 +0000
      Re: regex reserved chars Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 20:06 -0500
        Re: regex reserved chars markspace <markspace@nospam.nospam> - 2013-02-08 19:02 -0800
          Re: regex reserved chars Nigel Wade <nmw@ion.le.ac.uk> - 2013-02-11 09:25 +0000
            Re: regex reserved chars markspace <markspace@nospam.nospam> - 2013-02-11 07:16 -0800
              Re: regex reserved chars Nigel Wade <nmw@ion.le.ac.uk> - 2013-02-11 17:12 +0000
  Re: regex reserved chars Roedy Green <see_website@mindprod.com.invalid> - 2013-02-06 23:31 -0800
    Re: regex reserved chars Robert Klemme <shortcutter@googlemail.com> - 2013-02-07 04:38 -0800
    Re: regex reserved chars Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 20:02 -0500

csiph-web