Regular expression problem: independent location of words

Is it possible to define a regular expression pattern that checks for example. The 3 words are independent of their position in the main chord?

For example, my string is like “click here to unsubscribe: http://www.url.com”

The pattern should also be the same as “http: //Unsubscribe and click “to use together

Thank you

you can use positive lookaheads. For example,

(?=.*click)(?=.*unsubscribe).*http

is a regular expression , It will look forward from the current position (not move forward), click, then unsubscribe, and then search http normally.

Is it possible to define a check For example, the regular expression pattern. Are 3 words independent of their position in the main chord?

For example, my string is like “click here to unsubscribe: http://www.url.com”

The pattern should also be the same as “http: //Unsubscribe and click “Use together

Thank you

You can use positive lookaheads. For example,

< p>

(?=.*click)(?=.*unsubscribe).*http

is a regular expression, it will look forward from the current position (not to Move forward) to click, then unsubscribe, and then search http normally.

Leave a Comment

Your email address will not be published.