import re
sentence = "1111Austria9999Salzburg (SZG)Vienna (VIE)1111Bosnia-Herzegovina9999Sarajevo (SJJ)1111Bulgaria9999Bourgas (BOJ)Varna (VAR)"
regs = re.findall(r'[A-z]+\s\([A-Z]{3}\)', sentence)
print(regs)
This follows from my logic in the comments.
More Related Contents:
- Convert array dictionary to a dictionary python
- Tkinter assign button command in a for loop with lambda [duplicate]
- How can I schedule updates (f/e, to update a clock) in tkinter?
- How to get current CPU and RAM usage in Python?
- Division in Python 2.7. and 3.3 [duplicate]
- Installing Python packages from local file system folder to virtualenv with pip
- How to get the location of all text present in an image using OpenCV?
- Loop backwards using indices
- How to find out the number of CPUs using python
- How to efficiently calculate a running standard deviation
- Listing available com ports with Python
- How to Execute a Python Script in Notepad++?
- Appending a dictionary to a list – I see a pointer like behavior
- if A vs if A is not None:
- How can I plot a confusion matrix? [duplicate]
- How to install pip for Python 3 on Mac OS X?
- python: read lines from compressed text files
- How to split/partition a dataset into training and test datasets for, e.g., cross validation?
- Save a subplot in matplotlib
- django-filter use paginations
- How does Keras 1d convolution layer work with word embeddings – text classification problem? (Filters, kernel size, and all hyperparameter)
- sudo pip install VS pip install –user
- python: class attributes and instance attributes
- python – While Loop causes entire program to crash in Tkinter
- How to set class attribute with await in __init__
- Cmake is not able to find Python-libraries
- re.findall which returns a dict of named capturing groups?
- How to get the localStorage with Python and Selenium WebDriver
- Most efficient way to parse a large .csv in python?
- String concatenate TypeError: can only concatenate str (not “int”) to str”