I'm in the process of updating a program that fixes the subtitle
So far I Regular expressions have disappeared without using them, but the last problem that has arisen can be benefited by using them. (I have already sorted it without regular expressions, but it is a very unused method which slow down my schedule).
TL; Dr;
I am trying to make the following work:
I would like all these examples:
"!."
, "!
and "!." To become
: "!"
As long as the dot is not the second dot, I want all the examples:
"!."
, " ! .. "
, " !! "
and "! .." to become:
: "! ..."
I tried this code: < / P>
the_str = Regex.Replace (the_str, "\\! \\. [^.]", "\\! [^.]");
That comes close to the first part of what I want to do, but I can not do [^.]
Same character similar to one of the original strings ... please help!
I am interested in both C # and PHP implementation ...
< Code> $ str = preg_replace ('/! (?: \ S *.) {2,3} /', '! ...', $ str); $ Str = preg_replace ('/! \ S *. (?! \ S *.) /', '!', $ Str);
It works in PCRS. You can probably merge it into one to do some magic, but it will not be readable anymore. First PCE ! ...
, !
is the second one! They are quite simple.
Comments
Post a Comment