Menu

Ignore newlines

2008-02-23
2012-11-13
  • Nobody/Anonymous

    I have some html files full of code like:

    <span style='font-family:Symbol;mso-ascii-font-family:
    "Times New Roman";mso-hansi-font-family:"Times New Roman";mso-char-type:symbol;
    mso-symbol-font-family:Symbol'><span style='mso-char-type:symbol;mso-symbol-font-family:
    Symbol'>b</span></span>

    I want to replace it with simple &beta; but the line breaks can occur in several places of the string. Can I ignore the newline characters (and possibly spaces too, ie 'font-family:"Times' vs 'font-family: "Times' and match the text?

     
    • Nobody/Anonymous

      Yes, you can by using regex to indicate potential occurrences (?) and entering newlines as hex characters.

       
    • Nobody/Anonymous

      So I have to enter (newline character)? after every character of the string?

       
      • Nobody/Anonymous

        Actually, yes. Your question sounds like this is a problem to you, whether I present it to you as a solution. The question is: do you want to solve your problem or not, or do you only want to solve your problem in a way that doesn't ask any input from you?

         
        • Nobody/Anonymous

          Smart thinking gets you a little further.

          You can get rid of all the newlines within your matches first, so you won't have to take them into account when doing the real search. You could achieve this by simply removing _all_ newline characters. This may be a problem later, when you would like to have your text reformatted in the original way. Therefor, you may exclude real or wanted newlines by replacing them with (or adding) some special character (string) first. Later you can restore the wanted newlines back by replacing or removing the special character (string).

           
          • Nobody/Anonymous

            Perhaps you will also find some help or ideas in the message by fidvo in this recent thread:

            "macro bug (New)"
            http://sourceforge.net/forum/forum.php?thread_id=1942910&forum_id=331754

            reply: By: fidvo (fidvo) - 2008-02-18 15:21