Regex problem
Posted: Wed Jan 16, 2008 10:15 am
regex wizes look over here!
I need a regex that will react on the following characters:
?
!
.
;
:
\n
although a string like: ... or ??? should be treated as one reaction, but if more dots or questionmarks are shown later on in the full string it should react to that to
also I need it to react on smileys, such as :) :P :D ;) ;P ;p :p etcetera, this interfers with the previous engagement to react on : and ;, making a smiley to split up into : and ), ; and p for example
basically I need to split up a string with delimiters being those, for example this text:
"Hello and welcome to my site! This site will be about everything about computers...
Does this seem like a good idea? Or does it not, heh :) Bye"
that text should be split up to this:
1 => Hello and welcome to my site!
2 => This site will be about everything about computers...
3 => Does this seem like a good idea?
4 => Or does it not, heh :)
5 => Bye
Because it already splits up every ":" it will split the smiley as
4 => Or does it not, heh :
5 => ) Bye
and because it splits up each dot I guess it'll make it like this:
2 => This site will be about everything about computers.
3 => .
4 => .
5 => Does it seem like a good idea?
But I'm only sure about the smiley splitup
I need a regex that will react on the following characters:
?
!
.
;
:
\n
although a string like: ... or ??? should be treated as one reaction, but if more dots or questionmarks are shown later on in the full string it should react to that to
also I need it to react on smileys, such as :) :P :D ;) ;P ;p :p etcetera, this interfers with the previous engagement to react on : and ;, making a smiley to split up into : and ), ; and p for example
basically I need to split up a string with delimiters being those, for example this text:
"Hello and welcome to my site! This site will be about everything about computers...
Does this seem like a good idea? Or does it not, heh :) Bye"
that text should be split up to this:
1 => Hello and welcome to my site!
2 => This site will be about everything about computers...
3 => Does this seem like a good idea?
4 => Or does it not, heh :)
5 => Bye
Because it already splits up every ":" it will split the smiley as
4 => Or does it not, heh :
5 => ) Bye
and because it splits up each dot I guess it'll make it like this:
2 => This site will be about everything about computers.
3 => .
4 => .
5 => Does it seem like a good idea?
But I'm only sure about the smiley splitup