Find text at the beginning of file

Find text at the beginning of file

3
NewbieNewbie
3

    Nov 07, 2019#1

    I have to search all files that start with a certain text. Some of the files have a BOM, others don't.
    Is there a way to do that with a regular expression?

    Regards
    Christian

    19476
    MasterMaster
    19476

      Nov 07, 2019#2

      Hi Christian,

      I hope that BOM is excluded from regex matching. This works for me (in Npp at least) - the beginning of the 1st line:
      (?<!(?s:.))^

      BR, Fleggy

      3
      NewbieNewbie
      3

        Nov 07, 2019#3

        My search text is object

        So the expression to use is (?<!(?object:.))^    ?

        And what kind is it? Perl, Unix, UltraEdit?

        I never really became familiar with regular expressions, so I have to ask.

        Christian

        19476
        MasterMaster
        19476

          Nov 07, 2019#4

          Hi,

          use Perl regex:
          (?<!(?s:.))^object
          or perhaps (you have to try):
          \A^object

          Please, check them carefully as I can't verify them in UE at this moment. The negative lookbehind (?<!...) sometimes does not work as supposed because of wrong implementation.

          BR, Fleggy

          3
          NewbieNewbie
          3

            Nov 07, 2019#5

            Thanks, this works.

            Christian