The Artima Developer Community
Sponsored Link

Java Buzz Forum
Java Regex Gotchas...

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Joe Shelby

Posts: 101
Nickname: acroyear
Registered: Jun, 2003

Joe Shelby is a senior software developer at ISX Corporation.
Java Regex Gotchas... Posted: May 19, 2004 9:30 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Joe Shelby.
Original Post: Java Regex Gotchas...
Feed Title: Joe's Java Jottings
Feed URL: http://www.blog-city.com/bc/
Feed Description: Notes, observations, and occasional other stuff on Java, with concentrations on Swing, XML, and the Semantic (Object) Web.
Latest Java Buzz Posts
Latest Java Buzz Posts by Joe Shelby
Latest Posts From Joe's Java Jottings

Advertisement
When doing a substitution, jakarta regexp and oro will both consider the $g syntax, but ignore it if the $ in your replacement string isn't a digit, and simply return the $ untouched.

Java Regex, on the other hand, throws an exception if the character after the $ isn't a digit.  The only way to handle it for now is to escape the $ with \ in the replacement before doing the substitution.  Tiger will have a fix that can just turn the thing off entirely, but fat lot of good that does me now...

Should have just used jakarta-regexp to start with...

Actually, I played with extracting the "commons" (but not officially "commons") regex wrapper layer that Ant has, and I probably should have continued using that instead; it would allow me to quickly switch to a jakarta regex library without any code-changes.  I might release that extracted codebase someday...

Read: Java Regex Gotchas...

Topic: I have got a GMail Previous Topic   Next Topic Topic: Pnuts Updates (1.1beta: try/catch/finally, do..while, and simple generators)

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use