How to find paragraphs not containing at least one of two words?

How to find paragraphs not containing at least one of two words?

17
Basic UserBasic User
17

    Oct 11, 2014#1

    Hi,

    I have groups of data in text file in the below order.

    Code: Select all

    _item 1
    _full Author, Name. welcome to our country, saturday, XXX Press
    _author Name A.
    _title welcome to our country
    _other saturday, XXX Airways
    
    _item 2
    _full Public College, History of Aliens, 1850, well known event, yyy Press.
    _title History of Aliens
    _year 1850
    _other well known event, yyy Press.
    _nonauthor Public College
    
    _item 3
    _full New University, History of My Country, 1950, zzz Press.
    _title History of My Country
    _year 1950
    _other New University, zzz Press.
    Here item 1 has no issues. Item 2 and item 3 doesn't have authors.

    Item 2 has no author so "Public College" has placed as _nonauthor

    In item 3 I have to move the "New University" from _other to _nonauthor

    So I have to find the group that does not contain _author and _nonauthor. So that I can manually move the text.

    Please advice
    Arun

    6,675585
    Grand MasterGrand Master
    6,675585

      Oct 11, 2014#2

      Please use first the command Format - Trim Trailing Spaces on this file to make sure that all blank lines are really empty lines.

      And you should see DOS in status bar for this file as otherwise the expression below would not work. Convert the file from Unix/Mac to DOS if necessary.

      Now you can use a Perl regular expression Find with search string (?s)(?<=\r\n\r\n)(?:.(?!_author)(?!_nonauthor))*?(?=\r\n\r\n) to find paragraphs not containing either the string _author or _nonauthor.

      Please note that this expression ignores always first and last paragraph of the file as on first paragraph there are most likely not 2 carriage returns + line-feeds above and on last paragraph there are not 2 carriage returns + line-feeds at end.
      Best regards from an UC/UE/UES for Windows user from Austria

      17
      Basic UserBasic User
      17

        Oct 13, 2014#3

        Hi, your query worked perfectly. Thanks.