• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regex problem

 
nithin kamath
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a string {abc.def}, I want to use a regular expression which replaces any non alphanumeric things at the begining and the end with an empty space. I have tried (^[^a-zA-Z0-9]) which removes the characters from the begining and this ([^a-zA-Z0-9]$) which removes it from the end, I would like to know how i can combine both of them. I have tried appending a .* in between which does not seem to work.

regards
nithin
 
krishna bala
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
nithin kamath
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The string which i am referring to is {abc.def}(with the braces). Specifically i want to remove anything that's not alphanumeric at the begininig or the end with an empty space. i.e in the example of {abc.def} replace it with abc.def. I tried the solution given above, it still prints {abc.def} if i use it.

Thanks and regards
nithin
 
krishna bala
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
nithin kamath
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks... ..i probably missed the ^ last time...

regards
nithin
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic