msqar
msqar

Reputation: 3040

How can I make my TinyMCE regex stop stripping out semicolons?

I'm using TinyMCE and my image URLs contain ; in some part of the URL.

i.e.:

http://www.example.com/ShowAsset;sessionid=23409234BASJDKLA?id=123123

When TinyMCE parses the CSS styles of the content, and executes a regex, it strips out the ;, cutting in half the URL and making it an invalid IMG URL.

http://www.example.com/ShowAsset

The regex that is used to parse the styles is:

"\s*([^:]+):\s*([^;]+);?"

It totally makes sense that it splits the string by ";", since that marks the end of each style, but is there a way to make it clever and allow ; in the URL?

Upvotes: 2

Views: 198

Answers (1)

Shrinivas Shukla
Shrinivas Shukla

Reputation: 4463

If it is possible to change the regex which is used to parse the styles, change it to

(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?.

It will allow ; in URLs.

See this

Upvotes: 1

Related Questions