Python Forum
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regex search for string
#1
Hello,

I'm trying to formulate a regex search to see if this exact string, ''op_single_selector" exists in this line of text:

-> [!div class="op_single_selector"]

This is what I have now that's not working:

selector_string = False
single_selector_regex_search_string = re.compile(r"[\+-]>\s\[op_single_selector\]")
if single_selector_regex_search_string.search(file_information.patch):
    selector_string = True
Reply


Messages In This Thread
Regex search for string - by DBS - Feb-06-2017, 08:33 PM
RE: Regex search for string - by metulburr - Feb-06-2017, 09:16 PM
RE: Regex search for string - by DBS - Feb-06-2017, 09:34 PM
RE: Regex search for string - by Ofnuts - Feb-06-2017, 11:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  string parsing with re.search() delahug 9 3,705 Jun-04-2020, 07:02 PM
Last Post: delahug
  [Learning:bs4, re.search] - RegEx string cutoff jarmerfohn 5 3,702 Nov-23-2019, 09:32 AM
Last Post: buran

Forum Jump:

User Panel Messages

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