match regular expression before first \n

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • st12iker
    New Member
    • Jun 2007
    • 6

    match regular expression before first \n

    Im looking for a regex expression that would enable me to match a pattern only before the first \n of a line. So for example if I had text

    if $\ = $$ and had text
    123 DFG\n (1st line)
    $$
    345\n
    3678 DSGDFG\n
    678TY&^*\n
    (all 2nd line because of $\ = $$)
    $$
    789DHYUTN\n
    345345 SDFGDFG \n
    (3rd line)

    So I would need a search that would search only the text containing "345", " 123 DFG", and "786 ... " since they are all before the first \n of their respective lines. This is only an example to illustrate what I am having trouble with.
  • miller
    Recognized Expert Top Contributor
    • Oct 2006
    • 1086

    #2
    Originally posted by st12iker
    since they are all before the first \n of their respective lines
    Striker,

    This statement makes no sense. The \n is the return character so that denotes when a new line is. What do you mean respective lines?

    I believe that this probably is a continuation of your previous thread:
    change $/

    If this is the case, please limit your discussion to that single thread instead of starting new questions. It helps to know the entire context in which a question is asked, as often a solution to the problem is best presented as an entirely different approach instead of the method that you are current attempting to get to work.

    - Miller

    Comment

    Working...