iamandrus
iamandrus

Reputation: 1430

Regex for getting URL-compatible directory?

I have an internal link system on my site, and I currently use this to detect text after a markup:

'/__IL__(.+)/'

The problem with this is that it picks up characters like "<", meaning if someone uses a line break, the result will be this:

http://www.[sitename].org/[user's url] <br/>

What would be a better regex expression for that? Thanks.

Upvotes: 1

Views: 137

Answers (1)

Michael
Michael

Reputation: 35331

Try instructing your regular expression to include all characters BUT the character that begins an HTML tag:

'/__IL__([^<]+)/'

Upvotes: 1

Related Questions