• Post Reply Bookmark Topic Watch Topic
  • New Topic

solved: (finding) matching regex pattern  RSS feed

 
Igor Mechnikov
Ranch Hand
Posts: 100
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy,

I am running an Interpreted Java script and trying to match a line of input to regex "td title".
Please tell me where I err.
Edit: I figured that .matches requires exact match.
I need a method that determines whether input contains a match for the regex.



Edit 2. This works:

 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for sharing the solution with us.
 
Rob Spoor
Sheriff
Posts: 21050
85
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using ".*td title.*" for the regex would also have worked. The .* means any number of characters, so that full regex means "anything or nothing, followed by td title, followed by anything or nothing".
 
Igor Mechnikov
Ranch Hand
Posts: 100
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Using ".*td title.*" for the regex would also have worked. The .* means any number of characters, so that full regex means "anything or nothing, followed by td title, followed by anything or nothing".


Excellent point.

Thank you.
 
Rob Spoor
Sheriff
Posts: 21050
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!