• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Regular Expression Matching in Eclipse 3.1

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone tell me why this regular expression:

TO_Date[(][.]*[)]

Does not match this text:

TO_Date( '09/29/2005 08:28:21 AM', 'MM/DD/YYYY HH:MI:SS AM')

This is using eclipse 3.1 find/replace dialog with Regular Expression option checked.

Any help is appreciated.

Thanks,
Sheila.
 
Saloon Keeper
Posts: 24325
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because "(" and ")" are grouping operators. In RE's, almost any non-aphameric character should be escaped lest it prove to have unfortunare magic properties.

Try something like "TO_Date\(.*\)"
 
Sheila Hatfield
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Already tried that \(.*\) thing it didn't work. I thought anything in square brackets was taken literally in reg exp's?

This expression:

To_Date[(][a]*[)]

Matches, correctly I might add:

To_Date(a)
To_Date(aaaaa)

So I was pretty sure it wasn't the paren's but the stuff in between that were having problems. It seems like the . character simply isn't matching any character... Any other ideas?

Thanks for the reply tho!

Sheila
 
Tim Holloway
Saloon Keeper
Posts: 24325
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dumb question. You did check the "Regular Expressions" checkbox on the Find dialog, didn't you?

I have to ask, because I just tried the sequence I suggested and it worked for me.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is wrong is the [.], which stands for the character set containing a . (period, not "any" character). What you want is something like

TO_Date[(][^)]*[)]

[^)] means "any character EXCEPT )" if you included that, then the .* would just eat up everything---assuming the RE engine in eclipse is greedy.
[ October 18, 2005: Message edited by: Warren MacEvoy ]
 
Water proof donuts! Eat them while reading this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic