Python Forum
<b> followed by <b> before closing</b>
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
<b> followed by <b> before closing</b>
#2
something like that

import re

s = "<RF><b>1:4 <b>Hom wat is ... kom:</b>"

def repl(match, count=[0]):
    x, = count
    count[0] += 1
    if x > 0:
        return ''
    return '<b>'


print(re.sub('<b>', repl, s))
Output:
<RF><b>1:4 Hom wat is ... kom:</b>
Reply


Messages In This Thread
<b> followed by <b> before closing</b> - by WJSwan - Mar-20-2023, 01:12 PM
RE: <b> followed by <b> before closing</b> - by Axel_Erfurt - Mar-20-2023, 05:37 PM

Forum Jump:

User Panel Messages

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