im trying to create a pattern that will split my text on spaces, but not when there is <img infront.
this is becaus i want to split my text on spaces and place them between <span></span>, but when i add <img src=""> it will go like <span><img</span><span>src=""></span>.. wont work
my experience with regular expressions is not so great, but im trying my best
On parsing HTML with regular expressions, I would like to refer you to what I think must be the best answer ever given to a question on Stack Overflow:
For a discussion of that post, and why it's a bad idea, see: http://www.codinghorror.com/blog/200...hulhu-way.html
im not trying to parse, im trying to split and then with a forloop im adding the span classes.. does that make any difference?
Presumably you want to split on any spaces that aren't within <tags>. If so try splitting on this pattern:
Where used, return should be executed unconditionally and always as the last statement in the function.
That's my signature, it's not part of the damn post!
/\x20+(?![^<]*>)/ works thank you
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)