Python Forum
extract substring from a string before a word !!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
extract substring from a string before a word !!
#4
i solve it :
 requirement1 = re.search('data(.*)html', str(q))
    dd = requirement1.group(1)

    test_str = ''.join(letter for letter in dd if letter.isalnum())
    q = test_str.replace("title","\n")
    print(q)
thank u all
Reply


Messages In This Thread
RE: extract substring from a string before a word !! - by evilcode1 - Nov-08-2023, 12:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Retrieve word from string knob 4 560 Jan-22-2024, 06:40 PM
Last Post: Pedroski55
  [SOLVED] [regex] Why isn't possible substring ignored? Winfried 4 1,152 Apr-08-2023, 06:36 PM
Last Post: Winfried
  extract last word from path. mg24 4 1,834 Nov-01-2022, 10:55 AM
Last Post: carecavoador
  ValueError: substring not found nby2001 4 8,084 Aug-08-2022, 11:16 AM
Last Post: rob101
  Match substring using regex Pavel_47 6 1,504 Jul-18-2022, 07:46 AM
Last Post: Pavel_47
  Isolate a word from a long string nicocorico 2 1,587 Feb-25-2022, 01:12 PM
Last Post: nicocorico
  Substring Counting shelbyahn 4 6,220 Jan-13-2022, 10:08 AM
Last Post: krisputas
  Extract a string between 2 words from a text file OscarBoots 2 1,915 Nov-02-2021, 08:50 AM
Last Post: ibreeden
  change string in MS word Mr_Blue 8 3,463 Sep-19-2021, 02:13 PM
Last Post: snippsat
Question Problem: Check if a list contains a word and then continue with the next word Mangono 2 2,575 Aug-12-2021, 04:25 PM
Last Post: palladium

Forum Jump:

User Panel Messages

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