<eugeny.satt
...@gmail.com> wrote:
> try this
> [\r\n]+\s*\#define\x20+LOGGING_ENABLED\s*[\r\n]+
> that is line break(s) followed by optional space(s) followed by
> "#define LOGGING_ENABLED" followed bt optional space(s) followed by
> linebreak(s)
> while this enhancement should fit for start of file and end of file
> locations, as well.
> (\A|[\r\n]+)\s*\#define\x20+LOGGING_ENABLED\s*([\r\n]+|\Z)
> excerpt from help:
> --------------------
> \A only ever matches at the start of the string. Likewise, \Z only
> ever matches at the end of the string. These two tokens never match at
> line breaks. This is true in all regex flavors discussed in this
> tutorial, even when you turn on "multiline mode". In EditPad Pro and
> PowerGREP, where the caret and dollar always match at the start and
> end of lines, \A and \Z only match at the start and the end of the
> entire file.
> JavaScript, POSIX and XML do not support \A and \Z. Use the caret and
> dollar for this purpose.
> On 15 October, 08:28, Shreyas <shreyasbhar...@gmail.com> wrote:
> > How do I construct a regex that finds just the first instance in the
> > following test sample -
> > #define LOGGING_ENABLED
> > //#define LOGGING_ENABLED
> > // #define LOGGING_ENABLED
> > /* #define LOGGING_ENABLED */
> > /*#define LOGGING_ENABLED*/
> > i.e. the result should be #define LOGGING_ENABLED. As you can see I am
> > trying to find instances of the #define which are not commented out.
> > I'd appreciate any help.
> > - Shreyas.