• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regular expression in java 1.4

 
Ashutosh Singh Jadon
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

i have a project in java1.4 where i am tring to insert a string in method with regular expression($) but it is giving me the error array index out of bound . can any one suggest me the method to convert that (string+regular expression) into (string) .
String s = obj.getString(); -- giving an error arrayindexoutofbound .
s="my data commissoned to $125";
 
Ashutosh Singh Jadon
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ashutosh Singh Jadon wrote:hi all,

i have a project in java1.4 where i am tring to insert a string in method with regular expression($) but it is giving me the error array index out of bound . can any one suggest me the method to convert that (string+regular expression) into (string) .
String s = obj.getString(); -- giving an error arrayindexoutofbound .
s="my data commissoned to $125";

String coming in this getter method is "my data commissoned to $125" and because of this $ sign it is giving the exception . is there any way to get this string as a string in java 1.4 .
 
Tim Moores
Bartender
Posts: 2747
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The $ symbol has special meaning in regexps; you need to escape it via a single (or double, depending on context) backslash, like \$ or \\$.
 
Ashutosh Singh Jadon
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim , can we convert or nullify the regexps value in an string by any method in java1.4 because in java 1.5 there is quoteReplacement method .
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wrong forum. This forum is for Spring.

Not Strings. ;)

Moving this to some other forum that can take Regex questions.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic