Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
47 views

I want to exterect Name and Age through ^(\w+)\n(\d+)$ and it is working. if I use textfsm Why it is not giving data in correct format? data: Alice 37 Smith 41 template: Value Names (\w+) Value Ages (...
Nishant Thakur's user avatar
8 votes
2 answers
228 views

I'm working with a set of regex patterns that I have to match in a target text. My problematic regex is something like this: (İg)[[:punct:][:space:]]+[[:alnum:]]+ Initially, I noticed that Python’s re ...
Paolo Magnani's user avatar
0 votes
0 answers
49 views

I an writing a simple command interpreter for a project to allow the user to interact with a virtual world. In the commands the user can refer to objects by any number of different names, and the ...
dragoncoder047's user avatar
0 votes
1 answer
74 views

I have a regex pattern which represents a valid variable name in a language I'm trying to parse: R'\b([A-Z][A-Z0-9_]{0,35}\b' (e.g. VAR_NAME, TABLE_READ, SOME_OTHER_VAR etc..) However, I don't want to ...
SecBen.dev's user avatar
-1 votes
1 answer
465 views

I am developing an AWS Lambda function where I parse some input with the regex library. Here are the code snippets where it is used: import regex def lambda_handler(event, context): ... ...
Spiridon's user avatar
3 votes
0 answers
235 views

I'm trying to use jsonschema for a schema which uses "pattern". However in this application, the "pattern" needs to be able to match unicode characters, which is not support by ...
user1751825's user avatar
  • 4,337
0 votes
1 answer
157 views

I am trying to create a regex that would find one or more indices of the following pattern: some text + {text within braces} + {text within braces} The trick is that the text within braces may ...
Samuel Saari's user avatar
  • 1,185
0 votes
1 answer
56 views

I'm struggling to predict how many fuzzy matches findall() will return when using regex in Python with BESTMATCH enabled: >>> regex.findall(r'(?b)(North\ West){i<=0,s<=2,d<=1}', &...
Stefan's user avatar
  • 9,439
-1 votes
1 answer
94 views

I'm using https://github.com/mrabarnett/mrab-regex (via pip install regex, but experiencing a failure here: pattern_string = r''' (?&N) ^ \W*? ENTRY \W* (?P<...
P i's user avatar
  • 31.3k
1 vote
1 answer
256 views

Wondering if there is a function such as match.groupdict() that catches repetition similar to match.captures function. When I run this code: import regex test = regex.compile("(?P<a>a)*(?P&...
ajreckof's user avatar
2 votes
1 answer
382 views

I'm using several methods of regex module. I need to set timeouts for multiple compiled patterns, but despite example from docs, I'm unable to reproduce an exception doing the following: >>> ...
Kafka4PresidentNow's user avatar
1 vote
2 answers
490 views

import regex frase = "text https://www.gamivo.com/product/sea-of-thieves-pc-xbox-one other text https://www.gamivo.com/product/fifa-21-origin-eng-pl-cz-tr" x = regex.findall(r"/((http[s]...
Diego's user avatar
  • 25
1 vote
1 answer
1k views

I am trying to replace words in my string that contain a certain substring. Here is an example import regex as re given_in = 'My cat is not like other cats' desired_out = 'My foo is not like other ...
emilaz's user avatar
  • 2,182
1 vote
1 answer
35 views

Note: I'm using pypi regex module I have the following regex pattern (flags V1 + VERBOSE): (?(DEFINE) (?P<id>[\d-]+) ) id:\s(?&id)(,\s(?&id))* How can I retrieve all the times the <...
François's user avatar
1 vote
1 answer
113 views

As the title reads, we can easily match nested parentheses in regex with e.g. (\(((?:[^()]+|(?1))+)) which will match balanced parentheses. How can we use a named subgroup instead, as e.g. in (?P<...
Jan's user avatar
  • 43.3k
1 vote
1 answer
1k views

I'm trying to make a regex where I have some duplicated group names, for instance, in the example below I want to find the values of ph, A and B such that if I replace them in the pattern, I retrieve ...
dhokas's user avatar
  • 1,799
1 vote
2 answers
357 views

I have the following problem: I have strings that contain numbers that may include dots or commas. E.g.: text = 'ην Θεσσαλονίκη και κατοικεί στην Καλαμαριά Θεσσαλονίκης, (οδός Επανομής 32)Το κεφάλαιο ...
user8270077's user avatar
  • 5,151
4 votes
3 answers
255 views

I am trying to find all occurances of a sub-string using regular expression. The sub-string is composed of three parts, starts with one or more 'A', followed by one or more 'N' and ended with one or ...
Saikat's user avatar
  • 1,229
1 vote
1 answer
168 views

I am attempting to write a program that validates documents written in a markup language similar to BBcode. This markup language has both matching ([b]bold[/b] text) and non-matching (today is [date])...
Elizabeth's user avatar
  • 499
1 vote
1 answer
166 views

1. About Python regex 2019.02.21 Python is upgrading the regex module. The latest release is from Feb 21, 2019. You can consult it here: https://pypi.org/project/regex/ It will replace the re module ...
K.Mulier's user avatar
  • 9,770
3 votes
1 answer
1k views

This is the module I'm asking about: https://pypi.org/project/regex/, it's Matthew Barnett's regex. In the project description page, the difference in behavior between V0 and V1 are stated as (note ...
iBug's user avatar
  • 37.6k
2 votes
1 answer
63 views

While working on an answer to this question, I came up with this regex: (?:(?!\2)(?:,foo=([^,]*),(?=())|.))*\2bar=2 (Note: this regex requires the PyPI regex module) (Short explanation: The regex ...
Aran-Fey's user avatar
  • 44k
2 votes
1 answer
154 views

I'm using the PyPI module regex for regex matching. It says Default Unicode word boundary The WORD flag changes the definition of a ‘word boundary’ to that of a default Unicode word boundary....
iBug's user avatar
  • 37.6k
2 votes
1 answer
402 views

I'm trying to find matching parentheses where there are also some more in the middle. I have the following regex that does that, it matches the parenthesis to find the one associated with it. What I ...
Jugg's user avatar
  • 63
13 votes
2 answers
17k views

I am trying to find strings which are at most two mistakes 'away' from the original pattern string (i.e. they differ by at most two letters). However, the following code isn't working as I would ...
Anon's user avatar
  • 641
1 vote
1 answer
542 views

I'm trying to use regular expressions to find a substring in a string of DNA. This substring has ambiguous bases, that like ATCGR, where R could be A or G. Also, the script must allow x number of ...
leleonp's user avatar
  • 67
7 votes
1 answer
3k views

Python's new regex module supports fuzzy string matching. Sing praises aloud (now). Per the docs: The ENHANCEMATCH flag makes fuzzy matching attempt to improve the fit of the next match that it ...
zelusp's user avatar
  • 3,728
-1 votes
1 answer
82 views

I'm trying to do some fuzzy matching on a string of DNA reads. I'd like to allow for up to 1 substitution error while at the same time allowing a particular basepair to be one of two options (A or G ...
Constantino's user avatar
  • 2,401
0 votes
1 answer
713 views

I have made a clumsy first attempt at fuzzy pattern matching using the re module in python 2.7. Unfortunately every attempt I make returns an empty list. I simply don't understand the syntax required....
poppyseeds's user avatar
29 votes
4 answers
82k views

I have this code for removing all punctuation from a regex string: import regex as re re.sub(ur"\p{P}+", "", txt) How would I change it to allow hyphens? If you could explain how you did it, that ...
John's user avatar
  • 3,115
3 votes
1 answer
4k views

When I found out that the python regex module allows fuzzy matching I was increasingly happy as it seemed as a simple solution to many of my problems. But now I am having a problem for which I did ...
Jens-Konrad Preem's user avatar
1 vote
1 answer
710 views

I'm having trouble getting set operators to work in the regex module (regex 2013-11-29) in python-3.x. For example, to match ASCII characters minus punctuation I have tried: import regex as rx data =...
ethann's user avatar
  • 209
1 vote
1 answer
170 views

im trying out the fuzzy function of the new regex module. in this case, i want there to find a match for all strings with <= 1 errors, but i'm having trouble with it import regex statement = '...
O.rka's user avatar
  • 31k
4 votes
2 answers
1k views

I'm using the "fuzzy match" functionality of the Regex module. How can I get the "fuzziness value" of a "match" which indicates how different the pattern is to the string, just like the "edit ...
tslmy's user avatar
  • 678
4 votes
1 answer
2k views

I'm testing the new python regex module, which allows for fuzzy string matching, and have been impressed with its capabilities so far. However, I've been having trouble making certain exceptions with ...
baobobs's user avatar
  • 723