4 Replies Latest reply on Dec 22, 2009 5:59 PM by mystagogos

    Regular Expression - find double hyphens only


      I am wondering if there's a way to write a regular expression to find double hyphens and change them to single hyphens.  The catch is that some of the text I'm searching through have multiple hyphens.




      str1 = "Here is my sample text with double -- and I would like to replace this with one hyphen."

      str2 = "Here is another sample with multiple hyphens ----- that I do not want to change but leave as is."


      Is there a way to change only str1 to a single hyphen and keep str2 as is?