Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Regex Problem

 
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to write a pattern but seems its not matching

I have



the pattern should start with http://localhost:8080/nn/searchengine/Jobs/ then should be followed by integer then optionally might contain another slash and any other char/String after this is irrelevant. The pattern should match

 
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you have the $ near the end of your pattern? That will match against the end of the string, which isn't what you want.
 
Bartender
Posts: 10777
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Abiodun Adisa wrote:I am trying to write a pattern but seems its not matching


What Matthew said.

However, you could save yourself an enormous pattern (and possibly some time) by breaking up the search, perhaps something like:regexes are relatively expensive, so you should try not to make them any bigger than needed.

Winston

[Edit] corrected pattern
 
    Bookmark Topic Watch Topic
  • New Topic