• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regex or split()

 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
How does regex compare to split() when applied to the criteria in the criteriaFind() method?
I am currently using split() and I'm quite happy with it. But am I better off using regex for some reason I cannot make out ?
The only reason I can think of is that with split I am enforcing a character "," the Client has to supply in the string for criteriaFind() to split the string on , whereas with regex it may be totally generic and independent of any such enforcing of characters.
regards
[ March 25, 2003: Message edited by: HS Thomas ]
 
xin dong
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lev grevnin said:
You can use whatever you want to do the matching in criteria find. I used regex because it automatically checks for many different cases and makes sure your input string is correct. The matching is done in in fewer lines of code (although, the regular expressions themselves can be quite cryptic).

only depend on regex is not enough.it may also needs String.substring(),split(),or indexOf()..and so on. you can search the forum with "regex".there is a discussion named "criteriaFind with java.util.regex"
regards
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks xin,
I'll search on regex. Seems to be a favourite with many ranchers.
regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic