Python Forum
Need to match two words in a line
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to match two words in a line
#1
Good evening!
I'm trying to match two words and the "(" in a line.
these are" FAILED (Exit ", there is a space before the FAILED and after the Exit
here is what I come up with and it does not work... Confused
            if re.search("\sFAILED\s\(Exit",el)  : 
                print(f" ++===={el}")
                filtered.write(f"{el}"+"\n")
the regex probably looks laughable to you but that is my level of skills with regex for now.
Sorry about that. All help appreciated.
Tester.
Reply


Messages In This Thread
Need to match two words in a line - by tester_V - Nov-18-2022, 12:28 AM
RE: Need to match two words in a line - by tester_V - Nov-18-2022, 03:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Generate a string of words for multiple lists of words in txt files in order. AnicraftPlayz 2 2,871 Aug-11-2021, 03:45 PM
Last Post: jamesaarr
  Open and read multiple text files and match words kozaizsvemira 3 6,802 Jul-07-2021, 11:27 AM
Last Post: Larz60+
  If match not found print last line tester_V 2 2,923 Apr-26-2021, 05:18 AM
Last Post: tester_V
  item from a line to list however when i print the line instead of words i get letters Sutsro 5 3,026 Apr-22-2020, 02:39 PM
Last Post: deanhystad
  How do you replace a word after a match from a list of words in each line of a file? vijju56 1 3,497 Oct-17-2019, 03:04 PM
Last Post: baquerik
  Counting words in the last line of a file Drone4four 15 6,600 May-31-2019, 09:30 PM
Last Post: snippsat
  Compare all words in input() to all words in file Trianne 1 2,791 Oct-05-2018, 06:27 PM
Last Post: ichabod801
  How to find unique and common words per line from a txt file? sweet_swiss 6 4,319 Aug-11-2018, 01:28 PM
Last Post: Gribouillis
  Compare element of list with line of file : if match, delete line silfer 4 3,549 Jul-21-2018, 02:44 PM
Last Post: silfer

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020