Skip to main content

All Questions

Tagged with
1 vote
1 answer
43 views

Python2 multiple repeat error not occurring in Python 3/Javascript [duplicate]

I'm running this duckduckgo tracker rule through redshift so am locked to python 2. In python 2 when I run this I get "multiple repeat" error. I'm guessing the + signs aren't escaped is ...
user433342's user avatar
  • 1,059
0 votes
1 answer
48 views

Python split regex matches into two variables

I am trying to split a re.findall match into two variables - one for the date and one for the time - but i can't find a way to split the list up somehow. Any help appreciated! txt = "created_at': ...
Simon's user avatar
  • 43
-1 votes
3 answers
256 views

Extract the particular string from text file using python

This is the text file we need to extract the particular string from the text file using python or pandas Single quotes are present in that string >>>>>>>>>>>> [fgh: ...
DCompany's user avatar
2 votes
3 answers
184 views

error "unmatched group" when using re.sub in Python 2.7

I have a list of strings. Each element represents a field as key value separated by space: listA = [ 'abcd1-2 4d4e', 'xyz0-1 551', 'foo 3ea', 'bar1 2bd', 'mc-mqisd0-2 77a' ] Behavior I need to return ...
Vijesh's user avatar
  • 1,228
2 votes
1 answer
31 views

How to alternate capitalizations with RegEX?

I need to change a sentence to have alternating capitalizations! Having trouble making it ignore the spacebar inputs... input: the quick brown fox jumps over the lazy dog output: tHe QuIcK bRoWn FoX ...
Baldur's user avatar
  • 21
0 votes
1 answer
38 views

Regular Expression to match Digital Ocean Bucket Name Rule

I tried to write the regular expression to validate the Digital Ocean Bucket Name which has rule like this Bucket names can consist only of lowercase letters, numbers, dots (.), and hyphens (-). ...
Houy Narun's user avatar
  • 1,725
0 votes
1 answer
58 views

Imrove regex in Python (2.7) to find short / incomplete UK postcodes

I have a little function that finds full UK postcodes (e.g. DE2 7TT) in strings and returns them accordingly. However, I'd like to change it to ALSO return postcodes it gets where there's either one ...
ratuk_'s user avatar
  • 27
1 vote
1 answer
58 views

Edit regex to recognise very short street name or number for Python 2.7 script and avoid fatal attribute error

I have a little script in Python 2.7 with regex that recognises when a street or avenue name is in a string. However it doesn't work for street names of only two letters (OK that's very rare) OR ...
ratuk_'s user avatar
  • 27
2 votes
1 answer
41 views

Regex get data after |

This is my log 2022-06-29 12:45:04.652 | INFO | product.views.product_view:list:28 - SEARCH | Humana papa 2022-06-29 12:45:04.652 | INFO | product.views.product_view:list:28 - SEARCH | iPhone ...
CaptainPy's user avatar
0 votes
1 answer
149 views

Find IP address in multiple text files and replace it with another string in Python with regex

I have multiple text files as below: I want to read all of the text files and find the IP value in each file and replace it with the noresult string which is available in the text and save per file in ...
BrainGain's user avatar
0 votes
1 answer
1k views

Matching a Comma Separated List within Brackets

I have the following string that would be part of a file name. [Cast1, Cast2, Cast 3], this string is comma delimited. It would be at the end of a film title and be preceded with either a - or ~ The ...
Jason Hudson's user avatar
2 votes
2 answers
52 views

how to remove '18pieces' from '1903type18pieces' using regex?

I want to remove digit numbers and following strings till sentence end, but not numbers at sentence start. eg. remove "18pieces" from "1903type18pieces", not the whole "...
Z.Shuang's user avatar
0 votes
1 answer
50 views

I wrote a regex inside of a python script to analyse xml files but sadly its not working

I wrote a script to gather information out of an XML file. Inside, there are ENTITY's defined and I need a RegEx to get the value out of it. <!ENTITY ABC "123"> <!ENTITY ...
toki's user avatar
  • 11
-1 votes
1 answer
37 views

Regex for strings with $ signs, commas and decimals in Python [duplicate]

is it possible to have regex in Python that satisfies all the below STRING conditions? 1,000 1,000.00 $1,000.00 1000 -1000 I have the below but it doesn't satisfy all conditions: if bool(re.compile(r&...
user13074756's user avatar
0 votes
2 answers
50 views

Replace a certain part of the string which matches a pattern in python 2.7 and save in the same file

I am trying to achieve something of this sort My input file has this kind of entries art.range.field = 100 art.net.cap = 200 art.net.ht = 1000 art.net.dep = 8000 I am trying to match the pattern like ...
Saswata Kar's user avatar

15 30 50 per page
1
2 3 4 5
132