0 Replies Latest reply on Jul 16, 2008 7:48 AM by juhstin

    Match beginning of line with Regular Expression

    juhstin
      I'm confused about dreamweaver's treatment of the characters ^ and $ (beginning of line, end of line) in regex searches. It seems that these characters match the beginning of the file, not the beginning of the various lines in the file. I would expect it to work the other way around. A search like:
      (^.)
      should match every line in the file, so that a find/replace could be performed at the beginning of each line, like this:
      HELLO$1
      which would add 'HELLO' at the start of each line in the file.

      Instead, this action only matches the first character of the file, sticks 'HELLO' in front of it, and then quits (or moves on to the next file). The endline character $ behaves in a similar fashion, matching only the end of the file, not the end of each line.

      I've searched, and all the literature about regular expressions in dreamweaver seems to indicate that I'm expecting the correct behavior:

      www.adobe.com/devnet/dreamweaver/articles/regular_expressions_03.html
      quote:


      ^ Beginning of input or line ^T matches "T" in "This good earth" but not in "Uncle Tom's Cabin"
      $ End of input or line h$ matches "h" in "teach" but not in "teacher"



      Thanks for any insight, folks.