MyBB Community Forums
Search for a specific word in regex - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Resources (https://community.mybb.com/forum-8.html)
+--- Forum: MyCodes (https://community.mybb.com/forum-117.html)
+--- Thread: Search for a specific word in regex (/thread-207277.html)



Search for a specific word in regex - Nebulon Ranger - 2017-01-09

Hey,

I'm currently trying to implement some level of div-based image / text inlining and floating on my board for greater post formatting control, however I want to restrict the [div] tag's formatting options to only valid values of the CSS float, display and width properties using regex to search for these specific words in the tag. However, I can't seem to get it to work properly.

Here's the current state of my probably terrible regex:


\[div float="([right|left|none]+)" display="\([inline|inline-block|inherit|none]+)" width="(.*?)"\](.*?)\[/div\]

<div style="float:$1; display:$2; width:$3%;">$4</div>

Some pointers would be appreciated.

Thanks!


RE: Search for a specific word in regex - Devilshakerz - 2017-01-09

Try:
\[div float="(right|left|none)" display="(inline|inline-block|inherit|none)" width="([0-9]+)"\](.*?)\[\/div\]