All Questions
25 questions
-1
votes
1
answer
423
views
extract strings till ' \n ' character using lookbehnd in regex in python. And it can have alphanumeric characters, special characters and space also
text = ' My uncle is admitted in the hospital.\n He has been suffering from 10 months.\n The address of the hospital is \nApollo Health City Campus, Jubilee Hills, Hyderabad - 500 033. '
now i want ...
0
votes
1
answer
47
views
How can I strip a matching pattern by using a for-loop in python 2.7?
I am in the proces of making a dictionary of an OCR'd txt.file. At this point, I am trying to make a 'clean' slugline so that I - later - can easily identify specific parts of information I want to ...
0
votes
1
answer
40
views
Python Regex to Find Special Characters and characters in between
I have a csv file that looks like the following
Porta-a-Porta-d87134d1-e2bd-426b-b1f6-90d8dca68855;2842.020;2843.270;Unknown;; tecnici delle societ…
Porta-a-Porta-d87134d1-e2bd-426b-b1f6-90d8dca68855;...
-1
votes
2
answers
336
views
RegEx fails to capture groups in loops [duplicate]
Regex search fails to get a string from match object when being used in a for loop.
row_values = result_script_name.split('^')
for row in row_values:
table_name = re.search(r"(?<=')(.*)...
2
votes
2
answers
153
views
Split string around spaces without colons in between
I have a problem where I have to split strings if there is more than one space between two strings. But the condition is, that series of spaces should not follow a colon(:) or preceeds it (like in ...
1
vote
2
answers
593
views
Python regex optional capture group with positive lookahead
trying to find certain folder patterns. i can have a simple if statement but now I am wondering, Can this be done in one regex pattern?
folders:
name
name_a01
name_a02
..
name_a20
name_dontuse_a10 ...
0
votes
0
answers
36
views
Correct regex for finding string with two or three words in it
I have a text as given:
(3) Reflects the adoption of SFAS No. 128, EARNINGS PER SHARE.
<PAGE>
ITEM 7. MANAGEMENT'S DISCUSSION AND ANALYSIS OF FINANCIAL CONDITION AND RESULTS
OF ...
0
votes
1
answer
46
views
Exclude specific name in regex
I have multiple directories with names like app1.6.11, app1.7.12, app1.8.34, test1, test2.
I want to match regex for all the directories which start with app and to exclude app1.8.34.
I have tried:
...
0
votes
2
answers
50
views
Regex Grouping and extraction of particular group based on regex look behind
I want to extract digits after 'ID' occurrence in the following text
This is how I am able to get it.
import re
txt="Recharge done on 28-12-2017 04:57PM,MRP:Rs9.00,GST 18% payable by Company/...
2
votes
1
answer
3k
views
Regex distinguishing between Windows and Linux end of line characters
I'm trying to distinguish between Linux/Unix end of line character \n and the Windows end of line \r\n. I cannot seem to find a unique regex string that will distinguish between the two situations. My ...
2
votes
3
answers
123
views
How do I dynamically capture in regex two dates from one line of text?
I have a text that will change weekly:
text = "Weekly Comparison, Week 50 October 28 - November 3, 2016 October 30 - November 5, 2015"
I'm looking for regex patterns for year 1, and year 2.
(Both ...
1
vote
1
answer
43
views
Need help in RegEx to grab anything after a mandatory value
I have a text in which I need to grab data and split it up. I need to find "Review frequency" within a large group of text, then once that is found, take everything after it and stop at the ')'.
...
0
votes
2
answers
83
views
Match two groups but none of them should be empty
I want my regex to be able to match strings of random chars optionally followed by some digits - but if both matches are empty I want the match to fail. I am currently constructing the regex as in:
...
-2
votes
1
answer
33
views
How can I construct a regex that finds all groups between two expressions?
Suppose I have the text
lorem ipsum: *(some amount of whitespace)*
data1 *(some amount of whitespace)*
data2 *(some amount of whitespace)*
...dataN *(some amount of whitespace)*
*(empty line)*
And I ...
0
votes
4
answers
74
views
Need regex to take only the first two sentences even if other instances occur
I need help with a regex that finds the first two words at the start then takes only the first two sentences after, despite how many instances occur in the text.
text = "The Smithsonian museum is ...