Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #22182 > unrolled thread
| Started by | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| First post | 2013-02-06 16:28 -0800 |
| Last post | 2013-02-08 20:02 -0500 |
| Articles | 6 on this page of 26 — 9 participants |
Back to article view | Back to comp.lang.java.programmer
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
Page 2 of 2 — ← Prev page 1 [2]
| From | Nigel Wade <nmw@ion.le.ac.uk> |
|---|---|
| Date | 2013-02-11 09:25 +0000 |
| Message-ID | <anrrnkFj2giU1@mid.individual.net> |
| In reply to | #22238 |
On 09/02/13 03:02, markspace wrote: > 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. Er, not quite. There's also '^' which, as the first character only, negates the match. Under the section "Character classes": [^abc] Any character except a, b, or c (negation) -- Nigel Wade
[toc] | [prev] | [next] | [standalone]
| From | markspace <markspace@nospam.nospam> |
|---|---|
| Date | 2013-02-11 07:16 -0800 |
| Message-ID | <kfb1ud$gnk$1@dont-email.me> |
| In reply to | #22271 |
On 2/11/2013 1:25 AM, Nigel Wade wrote: > Er, not quite. There's also '^' which, as the first character only, > negates the match. Did you read the next paragraph where I mention this? I wrote: > (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.)
[toc] | [prev] | [next] | [standalone]
| From | Nigel Wade <nmw@ion.le.ac.uk> |
|---|---|
| Date | 2013-02-11 17:12 +0000 |
| Message-ID | <ansn40Fpc7gU1@mid.individual.net> |
| In reply to | #22273 |
On 11/02/13 15:16, markspace wrote: > On 2/11/2013 1:25 AM, Nigel Wade wrote: > >> Er, not quite. There's also '^' which, as the first character only, >> negates the match. > > Did you read the next paragraph where I mention this? > Ah, not entirely. My mistake. -- Nigel Wade
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2013-02-06 23:31 -0800 |
| Message-ID | <epk6h8plvg3sbcnvnr43q6e99p9q8t8n66@4ax.com> |
| In reply to | #22182 |
On Wed, 06 Feb 2013 16:28:29 -0800, Roedy Green
<see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted
someone who said :
>ve always treated $ ( ) * + -. ? [ \ ] ^ { | }
>as reserved regex chars.
>I can't find any docs that say the list is different inside[ ].
I have not found an official source however it is claimed only [ - ^]
are reserved in character classes i.e inside [...]
I don't think that can be right. Surely $ is reserved too, and of
course \.
--
Roedy Green Canadian Mind Products http://mindprod.com
The first 90% of the code accounts for the first 90% of the development time.
The remaining 10% of the code accounts for the other 90% of the development
time.
~ Tom Cargill Ninety-ninety Law
[toc] | [prev] | [next] | [standalone]
| From | Robert Klemme <shortcutter@googlemail.com> |
|---|---|
| Date | 2013-02-07 04:38 -0800 |
| Message-ID | <e76ff74b-8d86-4457-a6fc-e458ab5c485b@googlegroups.com> |
| In reply to | #22192 |
On Thursday, February 7, 2013 8:31:47 AM UTC+1, Roedy Green wrote:
> On Wed, 06 Feb 2013 16:28:29 -0800, Roedy Green
>
> <see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted
> someone who said :
>
> >ve always treated $ ( ) * + -. ? [ \ ] ^ { | }
> >as reserved regex chars.
> >I can't find any docs that say the list is different inside[ ].
>
> I have not found an official source however it is claimed only [ - ^]
> are reserved in character classes i.e inside [...]
Is http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html not official enough? Or are you missing an more explicit explanation on that page?
> I don't think that can be right.
Roedy, why???
> Surely $ is reserved too, and of course \.
Dot has no special meaning and neither does $. Btw. you can easily test that. Apart from that dot with special meaning does not make sense in a character class if you think about it for a moment.
Cheers
robert
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2013-02-08 20:02 -0500 |
| Message-ID | <5115a027$0$288$14726298@news.sunsite.dk> |
| In reply to | #22192 |
On 2/7/2013 2:31 AM, Roedy Green wrote:
> On Wed, 06 Feb 2013 16:28:29 -0800, Roedy Green
> <see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted
> someone who said :
>
>> ve always treated $ ( ) * + -. ? [ \ ] ^ { | }
>> as reserved regex chars.
>> I can't find any docs that say the list is different inside[ ].
>
> I have not found an official source however it is claimed only [ - ^]
> are reserved in character classes i.e inside [...]
>
> I don't think that can be right. Surely $ is reserved too, and of
> course \.
I don't think "surely" can overrule documentation and
experimentation.
There is a reason that it is called software engineering
and not software feelings.
Arne
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.java.programmer
csiph-web