Wednesday 15 April 2015

java - RegEx for 4 values within a link (This or this or this etc) -


There is a bit of trouble with this.

Say I have a link that can include these values:

Balearic | Ibiza | Majorca | Menorca

Example 1: http://site.com/Menorca

Example 2: http: // site. Com / Ibiza

I just need to say that the link is any of those 4 (case is also insensitive) RegEx is required

Is there a right Points in the direction - it is not in any particular language, but the software I work on is Java based.

Thanks a lot - and I meanwhile! :)

You can use just:

  / / URL is your URL variable if (url.matches ("(? I) ^ http: // site \ .com / (Balearic | Ibiza | Marjika | Menorca) \ b. * $")) {// match succeeded Happened}   

(? I) will ensure that the case is ignored while comparing it.

No comments:

Post a Comment