-3

I have a log of strings formatted as the follow: - SEGA E-r. Ata{{r}}i\n - SEGA E-r. Atari\n

I want to obtain the final result of SEGA E-r Atari using regular expressions. Here's what I've written but it doesn't get me my expected result:

temp = re.findall('.*[^\{*][^\}*].*', 'SEGA E-r. Ata{{r}}i\n')

Here's what I get as the result:

['SEGA E-r Ata{{r}}i\\n']

Could you please help me with this?

Update:

The problem has been solved using the following line of code:

re.sub("[^a-zA-Z0-9 -]","",'SEGA E-r. Ata{{r}}i\n')
Amir
  • 10,600
  • 9
  • 48
  • 75

1 Answers1

2

Try something like this:

re.sub("[^a-zA-Z0-9 -]","",'SEGA E-r. Ata{{r}}i\n')

See this question for reference.

Community
  • 1
  • 1
Blair
  • 6,623
  • 1
  • 36
  • 42