-2

I want specific string from below text using regex.

str = 'Supervision68 - Outdoor Supervision In Compliance922 KAR 2:100 - 
Section 10(15) Each child'

Specific string : '68 - Outdoor Supervision In Compliance'

I have tried an get below result:

re.findall('\d+(.*?)922', str)

result: ' - Outdoor Supervision In Compliance'

evil007
  • 3
  • 4

1 Answers1

0

You almost had it:

import re
str = 'Supervision68 - Outdoor Supervision In Compliance922 KAR 2:100 - Section 10(15) Each child'
print(re.findall('(\d.*?)922', str))

OUTPUT:

['68 - Outdoor Supervision In Compliance']
DirtyBit
  • 16,613
  • 4
  • 34
  • 55