Case-insensitive REGEX

Hi, Trying to build a file-filter for my JAR Recipe object. I'm trying to use the regular-expression input method and have it be case-insensitive. Any ideas how this can be done?Thanks,Gili
[250 byte] By [Gili] at [2007-11-25 16:49:30]
# 1

Does this portion of NB use standard java.util.regex or "Perl"-style

regexes?

If anyone can say yes, you could try:

{?i}<your regex>

for java.util.regex syntax

or

/<your regex>/i

for Perl style regexes.

- Phil DeJarnett

"Gili" <sittingduck@bbs.darktech.org> wrote in message

news:netbeans.nbusers/whaxoofqnexgrpubet.gzwc5w0.pminews@news.netbeans.org..

.

Hi,

Trying to build a file-filter for my JAR Recipe object.

I'm trying to use the regular-expression input method and

have it be case-insensitive. Any ideas how this can be done?

Thanks,

Gili

DeJarnett,Phil at 2007-7-2 23:46:17 > top of Java-index,Archived Forums,Sun ONE Studio 4...
# 2

NetBeans uses org.apache.regexp.

You can use the MATCH_CASEINDEPENDENT flag:

new org.apache.regexp.RE("pattern", MATCH_CASEINDEPENDENT);

When using java.util.regex, there is Pattern.compile("pattern",

CASE_INSENSITIVE);

Regards,

Martin

Phil DeJarnett wrote:

>

> Does this portion of NB use standard java.util.regex or "Perl"-style

> regexes?

>

> If anyone can say yes, you could try:

>

> {?i}<your regex>

>

> for java.util.regex syntax

>

> or

>

> /<your regex>/i

>

> for Perl style regexes.

>

> - Phil DeJarnett

>

> "Gili" <sittingduck@bbs.darktech.org> wrote in message

> news:netbeans.nbusers/whaxoofqnexgrpubet.gzwc5w0.pminews@news.netbeans.org..

> .

> Hi,

>

> Trying to build a file-filter for my JAR Recipe object.

> I'm trying to use the regular-expression input method and

> have it be case-insensitive. Any ideas how this can be done?

>

> Thanks,

> Gili

Entlicher,Martin at 2007-7-2 23:46:17 > top of Java-index,Archived Forums,Sun ONE Studio 4...
# 3

Martin Entlicher wrote:

> NetBeans uses org.apache.regexp.

> You can use the MATCH_CASEINDEPENDENT flag:

> new org.apache.regexp.RE("pattern", MATCH_CASEINDEPENDENT);

>

> When using java.util.regex, there is Pattern.compile("pattern",

> CASE_INSENSITIVE);

I don't think you answered his question as such... I guess Gili means

that he is *using* the JAR Packager, not writing module code! So given

that jarpackager is compiled to do a case-sensitive match, can the regex

text itself override that, using one of the syntaxes that Phil suggested?

As far as I know Apache regexp does not support this, in which case Gili

you are out of luck (and please file a feature request).

-Jesse

>"Gili" <sittingduck@bbs.darktech.org> wrote:

>>Trying to build a file-filter for my JAR Recipe object.

>>I'm trying to use the regular-expression input method and

>>have it be case-insensitive. Any ideas how this can be done?

--

Jesse Glick <mailto:jesse.glick@sun.com> x22801

NetBeans, Open APIs <http://www.netbeans.org/>

Glick,Jesse at 2007-7-2 23:46:17 > top of Java-index,Archived Forums,Sun ONE Studio 4...
# 4

Jesse Glick wrote:

>

> Martin Entlicher wrote:

> > NetBeans uses org.apache.regexp.

> > You can use the MATCH_CASEINDEPENDENT flag:

> > new org.apache.regexp.RE("pattern", MATCH_CASEINDEPENDENT);

> >

> > When using java.util.regex, there is Pattern.compile("pattern",

> > CASE_INSENSITIVE);

>

> I don't think you answered his question as such... I guess Gili means

> that he is *using* the JAR Packager, not writing module code! So given

> that jarpackager is compiled to do a case-sensitive match, can the regex

> text itself override that, using one of the syntaxes that Phil suggested?

Oh I see. Thanks Jesse for clarifying this.

As to java.util.regex, I don't know whether "{?i}<your regex>" can be used as

Phil suggested. I didn't found anything like this at

http://java.sun.com/j2se/1.4/docs/api/java/util/regex/Pattern.html

>

> As far as I know Apache regexp does not support this, in which case Gili

> you are out of luck (and please file a feature request).

All we can do with this is either preprocess "{?i}" before passing it to RE or

use java.util.regex when the IDE is running on JDK 1.4.x.

Please submit the feature request to Issuezilla so that it will not be

forgotten, because the jarpackager module is currently not maintained.

>

> -Jesse

>

> >"Gili" <sittingduck@bbs.darktech.org> wrote:

> >>Trying to build a file-filter for my JAR Recipe object.

> >>I'm trying to use the regular-expression input method and

> >>have it be case-insensitive. Any ideas how this can be done?

>

> --

> Jesse Glick <mailto:jesse.glick@sun.com> x22801

> NetBeans, Open APIs <http://www.netbeans.org/>

Entlicher,Martin at 2007-7-2 23:46:17 > top of Java-index,Archived Forums,Sun ONE Studio 4...
# 5

Martin Entlicher wrote:

> As to java.util.regex, I don't know whether "{?i}<your regex>" can be used as

> Phil suggested. I didn't found anything like this at

> http://java.sun.com/j2se/1.4/docs/api/java/util/regex/Pattern.html

Look under "Special constructs (non-capturing)".

> All we can do with this is either preprocess "{?i}" before passing it to RE or

> use java.util.regex when the IDE is running on JDK 1.4.x.

Also user workaround equivalent to preprocessing: replace any letter in

your RE with a character set, so replace

\.txt$

with

\.[Tt][Xx][Tt]$

Cumbersome but should work.

-Jesse

--

Jesse Glick <mailto:jesse.glick@sun.com> x22801

NetBeans, Open APIs <http://www.netbeans.org/>

Glick,Jesse at 2007-7-2 23:46:17 > top of Java-index,Archived Forums,Sun ONE Studio 4...