0

I would like to split a string e.g.:

'JEBY VB /21/01 RG SPORT LTD 3802381001 - 21/01 COM BB3434345566778'

with a regular expression and need output:

['JEBY VB', 'RG SPORT LTD', 'COM BB']
2
  • The problem is that I am not much familiar with regular expression so, don't have an idea, which kind of regular expression have to write to get result. Commented Mar 18, 2015 at 15:43
  • Then please find yourself a regex tutorial (Python has one) and start learning. As it stands, it's not even clear what your rules for splitting are (just two or more non-letter characters in a row?) Commented Mar 18, 2015 at 15:44

1 Answer 1

1

You can use the regex that negates all letters and a space, something like:

re.split(r'(?i)\s*[^a-z ]+\s*', 'JEBY VB /21/01 RG SPORT LTD 3802381001 - 21/01 COM BB3434345566778')

But you will have to omit empty chunks if any.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.