Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
3 votes
1 answer
55 views

python regex to get text within a pattern defined

I'm working on writing a parser to extract information from the output given below i need to get all the three texts which are in between '--'. so i wrote a regular expression as below import re def ...
Vijay's user avatar
  • 1,713
2 votes
1 answer
79 views

Using callable_iterator (re.finditer) causes Python to freeze

I have a function that is called for every line of a text. def tokenize_line(line: str, cmd = ''): matches = re.finditer(Patterns.SUPPORTED_TOKENS, line) tokens_found, not_found, start_idx = []...
Martin A.'s user avatar
0 votes
0 answers
22 views

Extract specific numbers of substrings from a string python [duplicate]

I have many strings, Here is one example string: test_str = "Discharge Attending:<pgno1> Bpractitionert practitioner name XX<pgno1> Discharge Diagnoses:<pgno1> X<pgno1> X&...
Shubham R's user avatar
  • 7,536
0 votes
1 answer
45 views

Find a Substring in String with Boardtools is not working if the string contains special chars

Today I got frustrated. I'm implementing a very simple logic with substring finding; it turned out to be a more complex situation. Let's consider this small python code: word_one, word_two = ['(/ %$ss%...
Allan Karlson's user avatar
2 votes
3 answers
68 views

Regex: Find matches only outside of single quotes

I currently have a regex that selects all occurrences of (, , , );: (\s\()|(,\s)|(\),)|(\);) however, I've been trying to figure out a way so that if anything is between single quotes 'like this, for ...
RadicalRaccoon's user avatar
1 vote
2 answers
76 views

Regex to substitute the next two words after a matching point

I'm writing a Regex to substitute the maximum of the next two words after the matching point. Expected prefixes: dr, doctor, pr, professor Sample text: Examination carried out in agreement with and ...
Januka samaranyake's user avatar
-2 votes
1 answer
30 views

regular expression to find pattern in the same word [duplicate]

There is a string "123:987 767687:99 145:986 156:876 " My regex expression is (\d{3}):\1 I expecting the result is 123:987, 145:986, 156:876 there is no result found. i dont undertsand. ...
Анатолій's user avatar
-4 votes
1 answer
76 views

Remove e-mail address with whitespaces [closed]

I am working with call centre transcripts. In an ideal case the speech-to-text software will transcribe an e-mail as follows: [email protected]. This will not always be the case. So I am looking at ...
Simone's user avatar
  • 595
0 votes
1 answer
67 views

How to get cleaned data from a noisy tsv file using regex?

I've to clean the data which is stored in a tsv to a dataframe using regex , for reference the data looks like this ps8trw17rlo16s dh7r1wjixjse72 Theoretical movements expensive. In rural areas, ...
kohpee_snob_kv's user avatar
2 votes
1 answer
88 views

How to remove specific parts of text from string?

I am using Python. I have a dataframe with string "description". In these strings, I have things like: "п. 5.6.2 ГОСТ 2.114-2016", "п. 4.1 ГОСТ 2.102-2013", "п.5 ...
user24958090's user avatar
2 votes
1 answer
47 views

Identifying and retrieving particular sequences of characters from within text fields containing Basic Data desc

I have a list named MAT_DESC that contains material descriptions in a free-text format. Here are some sample values from the MAT_DESC column: QWERTYUI PN-DR, Coarse, TR, 1-1/2 in, 50/Carton, 200 ea/...
rohi's user avatar
  • 305
0 votes
0 answers
42 views

Regular Expression extracting strings between matches

I am trying to assign the text of a PDF to columns and using a regular expression to get the values in between matches in column headers. Ultimately for CSV. I am getting the Year data printed twice, ...
Brooke's user avatar
  • 19
0 votes
1 answer
47 views

How to get a next line after a match using python regex [duplicate]

I'm relatively new to python and writing a code to get to the next line after a python regex match. I looked into the examples like https://regex101.com/r/dQ0gR6/1 and after match, get next line in a ...
Vijay's user avatar
  • 1,713
0 votes
4 answers
81 views

How to find text and write to file in Python using regular expressions [duplicate]

I want to find the addresses from the below text Private Key HEX: 81533e629f27aee5ec97b425a5a6a1ef35527fb1082db16776aa054c0db6c93f Private Key WIF: ...
Jimmy's user avatar
  • 13
3 votes
4 answers
68 views

Need help in matching string using regex until the last occurrence of open-close parenthesis with optional value in open-close parenthesis

I have few below example strings with me on which using regex I have to get the portion of it until the last occurrence of open-close parenthesis with optional value in open-close parenthesis. START ...
Tony Montana's user avatar
  • 1,012

15 30 50 per page
1
2 3 4 5
346