Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

Cannot get lookahead and lookbehind to work

  •  05-02-2007, 11:25 AM

    Cannot get lookahead and lookbehind to work

    Hello,

    I wonder if you can help me, this is driving me crazy!

    I have a large text file and I want to find a term in it.
    But... I only want the regex to be successful if this term is NOT encompassed by square brackets.

    e.g. this is the search term:    sp_W_rev_CreditClient_RMAItems
    I do not want this to be successful:     [sp_W_rev_CreditClient_RMAItems]

    Below is what I have tried, using negative lookahead and lookbehind,
    but it never returns ANY results no matter the search term!

    grep.exe -n "(?<!\[)sp_W_rev_CreditClient_RMAItems(?!\])" "C:\Solutions\ProcedureHouseKeeping\ProcedureHouseKeeping\bin\Debug\CHIP ALL DATABASE OBJECTS ANSI ENCODING.txt"

    I am using grep to search the file on the Windows Server 2003 platform
View Complete Thread