regex string matching python3

2018-10-01 Thread nanman3012
I have a string like this: b'\tC:94.3%[S:89.9%,D:4.4%],F:1.7%,M:4.0%,n:1440\n' And I would like to extract the numbers corresponding to S,D,F and M in this string and convert them into an array like this: [ '89.9', '4.4', '1.7', '4.0'] Any help would be appreciated! --

[issue34315] Regex not evalauated correctly

2018-09-11 Thread hongweipeng
hongweipeng added the comment: In my test in win2012r2, it works well. Add a screenshot. -- nosy: +hongweipeng Added file: https://bugs.python.org/file47794/win12r2py3.7.png ___ Python tracker

Re: regex pattern to extract repeating groups

2018-08-27 Thread MRAB
On 2018-08-28 00:58, Malcolm wrote: On 28/08/2018 7:09 AM, John Pote wrote: On 26/08/2018 00:55, Malcolm wrote: I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I

Re: regex pattern to extract repeating groups

2018-08-27 Thread Malcolm
On 28/08/2018 7:09 AM, John Pote wrote: On 26/08/2018 00:55, Malcolm wrote: I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do have a work around, but it's messy

Re: regex pattern to extract repeating groups

2018-08-27 Thread John Pote
On 26/08/2018 00:55, Malcolm wrote: I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do have a work around, but it's messy and possibly not future proof. Do you mean

Re: regex pattern to extract repeating groups

2018-08-27 Thread Rob Gaddi
On 08/25/2018 04:55 PM, Malcolm wrote: I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do have a work around, but it's messy and possibly not future proof. Any

regex pattern to extract repeating groups

2018-08-27 Thread Malcolm
I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do have a work around, but it's messy and possibly not future proof. Any insight greatly appreciated. Malcolm My

Re: Why this regex for string literals can't handle escaped quotes?.... '"(\\.|[^"])*"'

2018-08-09 Thread cseberino
Wow. Thanks. That cleared everything up. cs -- https://mail.python.org/mailman/listinfo/python-list

Re: Why this regex for string literals can't handle escaped quotes?.... '"(\\.|[^"])*"'

2018-08-09 Thread Peter Otten
cseber...@gmail.com wrote: > Why this regex for string literals > can't handle escaped quotes? '"(\\.|[^"])*"' > > See this... > >>>> string_re = '"(\\.|[^"])*"' > >>>> re.match(string_re, '""') > <

Why this regex for string literals can't handle escaped quotes?.... '"(\\.|[^"])*"'

2018-08-09 Thread cseberino
Why this regex for string literals can't handle escaped quotes? '"(\\.|[^"])*"' See this... >>> string_re = '"(\\.|[^"])*"' >>> re.match(string_re, '""') <_sre.SRE_Match object; span=(0, 6), match='""'> >

[issue34315] Regex not evalauated correctly

2018-08-02 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34315] Regex not evalauated correctly

2018-08-01 Thread Raman
New submission from Raman : Sample code below import re regex = r'DELETE\s*(?P[a-zA-z_0-9]*)\s*FROM\s*(?P[a-zA-z_0-9]+)\s*([a-zA-Z0-9_]*)\s*(?PWHERE){0,1}(\s.)*?' test_str = 'DELETE FROM my_table1 t_ WHERE id in (1,2,3)' matches = re.finditer(regex, test_str, re.MULTILINE) print

Re: Better way / regex to extract values form a dictionary

2018-07-22 Thread Thomas Jollans
On 21/07/18 14:39, Ganesh Pal wrote: >> The dictionary is irrelevant to your question. It doesn't matter whether >> the path came from a dict, a list, read directly from stdin, an >> environment variable, extracted from a CSV file, or plucked directly from >> outer space by the programmer. The

Re: Better way / regex to extract values form a dictionary

2018-07-21 Thread Ganesh Pal
> The dictionary is irrelevant to your question. It doesn't matter whether > the path came from a dict, a list, read directly from stdin, an > environment variable, extracted from a CSV file, or plucked directly from > outer space by the programmer. The process remains the same regardless of >

Re: Better way / regex to extract values form a dictionary

2018-07-21 Thread Steven D'Aprano
On Sat, 21 Jul 2018 17:07:04 +0530, Ganesh Pal wrote: > I have one of the dictionary values in the below format > > '/usr/local/ABCD/EDF/ASASAS/GTH/HELLO/MELLO/test04_Failures.log' > '/usr/local/ABCD/EDF/GTH/HEL/OOLO/MELLO/test02_Failures.log' >

Re: Better way / regex to extract values form a dictionary

2018-07-21 Thread Paul Moore
def return_filename_test_case(filepath): filename = os.path.basename(filepath) testcase = filename.partition('_')[0] return filename, testcase On 21 July 2018 at 12:37, Ganesh Pal wrote: > I have one of the dictionary values in the below format > >

Better way / regex to extract values form a dictionary

2018-07-21 Thread Ganesh Pal
I have one of the dictionary values in the below format '/usr/local/ABCD/EDF/ASASAS/GTH/HELLO/MELLO/test04_Failures.log' '/usr/local/ABCD/EDF/GTH/HEL/OOLO/MELLO/test02_Failures.log' '/usr/local/ABCD/EDF/GTH/BEL/LO/MELLO/test03_Failures.log' I need to extract the file name in the path example,

Re: Regex to extract multiple fields in the same line

2018-06-15 Thread Friedrich Rentsch
17 to 25 in the below code) Here is my code : root@X1:/Play_ground/SPECIAL_TYPES/REGEX# vim Friedrich.py 1 import re 2 from collections import OrderedDict 3 4 keys = ["struct", "loc", "size", "mirror", 5 "filename","

Re: Regex to extract multiple fields in the same line

2018-06-15 Thread Nathan Hilterbrand
ar/1000111/test18.log > 0 > 8 > > > Here is my sample code , its still not complete , I wanted to use regex > and find and extract all the fields after " =", any suggestion or > alternative way to optimize this further > > > import re > line = '06/12/

Re: How can I verify if the regex exist in a file without reading ?

2018-06-15 Thread francois . rabanel
seeing > it everywhere." -- Jon Ronson I resolve my problem and when I look to my solution I don't understand why I didn't do it earlier :) with open(path) as file: result = [] for line in file: find_regex = re.search(regex,line) if find_regex: result.append(find_regex.grou

Re: How can I verify if the regex exist in a file without reading ?

2018-06-15 Thread Steven D'Aprano
On Fri, 15 Jun 2018 01:01:03 -0700, francois.rabanel wrote: > I work with a file which contains millions lines, a simply file.read() > and I'm running out of memory Assuming each line is on average a hundred characters long, a million lines is (approximately) 100 MB. Even on a computer with

Re: Regex to extract multiple fields in the same line

2018-06-15 Thread Ganesh Pal
> >>>> {'struct': 'data_block', 'log_file': '/var/1000111/test18.log', 'loc': > '0', 'size': '8'} > > MARB, as usual the solution you you look nice, Thanks for the excellent solutions >>> regex = re.compile (r"--(struct|loc|size|mirror|l og_file)\s*

Re: How can I verify if the regex exist in a file without reading ?

2018-06-15 Thread francois . rabanel
Le vendredi 15 juin 2018 02:42:12 UTC+2, Cameron Simpson a écrit : > On 15Jun2018 00:24, Steven D'Aprano > wrote: > >On Fri, 15 Jun 2018 10:00:59 +1000, Cameron Simpson wrote: > >> Francois, unless your regex can cross multiple lines it is better to &

Re: How can I verify if the regex exist in a file without reading ?

2018-06-14 Thread Cameron Simpson
On 15Jun2018 00:24, Steven D'Aprano wrote: On Fri, 15 Jun 2018 10:00:59 +1000, Cameron Simpson wrote: Francois, unless your regex can cross multiple lines it is better to search files like this: with open(the_filename) as f: for line in f: ... search the line for the regexp

Re: How can I verify if the regex exist in a file without reading ?

2018-06-14 Thread Steven D'Aprano
On Fri, 15 Jun 2018 10:00:59 +1000, Cameron Simpson wrote: > Francois, unless your regex can cross multiple lines it is better to > search files like this: > > with open(the_filename) as f: > for line in f: > ... search the line for the regexp ... > > That w

Re: How can I verify if the regex exist in a file without reading ?

2018-06-14 Thread Cameron Simpson
to read the whole file into memory and match against it. Guessing: text = open(the_filename).read() ... search the text for the regexp ... Francois, unless your regex can cross multiple lines it is better to search files like this: with open(the_filename) as f: for line in f

Re: How can I verify if the regex exist in a file without reading ?

2018-06-14 Thread Steven D'Aprano
quot;os.rename" at the end. > > My problem is, if I work on a huge file, I'll try to avoid to read the > file because it will be crash my computer :) How does reading a file crash your computer? > and I would to verify if the regex enter by the user, exist. The only way to

How can I verify if the regex exist in a file without reading ?

2018-06-14 Thread francois . rabanel
id to read the file because it will be crash my computer :) and I would to verify if the regex enter by the user, exist. I don't know if it's possible, I'm looking for a solution since few hours... so sorry if the question is easy or wtf :) import re impo

Re: Regex to extract multiple fields in the same line

2018-06-13 Thread Friedrich Rentsch
e=8" at the end? That's what your explanation implied. How's this? (Supposing that the values contain no spaces): >>> regex = re.compile (r"--(struct|loc|size|mirror|log_file)\s*=\s*([^\s]+)") >>> regex.findall (line) [('struct', 'data_block'), ('log_file', '/var/100

Re: Regex to extract multiple fields in the same line

2018-06-13 Thread MRAB
ease let me know the mistakes in the below code and suggest if it can be optimized further with better regex # This code has to extract various the fields from a single line ( assuming the line is matched here ) of a log file that contains various values (and then store the extracted values in a dicti

Re: Regex to extract multiple fields in the same line

2018-06-13 Thread Ganesh Pal
extract all the required fields , I have 2 further questions too , please suggest Question 1: Please let me know the mistakes in the below code and suggest if it can be optimized further with better regex # This code has to extract various the fields from a single line ( assuming the line

Re: Regex to extract multiple fields in the same line

2018-06-13 Thread Rhodri James
On 13/06/18 09:08, Ganesh Pal wrote: Hi Team, I wanted to parse a file and extract few feilds that are present after "=" in a text file . Example , form the below line I need to extract the values present after --struct =, --loc=, --size= and --log_file= Sample input line = '06/12/2018

Regex to extract multiple fields in the same line

2018-06-13 Thread Ganesh Pal
--struct=data_block --log_file=/var/1000111/test18.log --addr=None --loc=0 --mirror=10 --path=/tmp/data_block.txt size=8' Expected output data_block /var/1000111/test18.log 0 8 Here is my sample code , its still not complete , I wanted to use regex and find and extract all the fields after

[issue33658] Introduce a method to concatenate regex patterns

2018-05-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is not trivial task because inline flags with global scope can be occurred in any part of the pattern (although using them not at the start of the pattern is deprecated). But starting with 3.7 you can use inline flags with

[issue33658] Introduce a method to concatenate regex patterns

2018-05-27 Thread Thrlwiti
Change by Thrlwiti : -- nosy: +THRlWiTi ___ Python tracker ___ ___ Python-bugs-list

[issue33658] Introduce a method to concatenate regex patterns

2018-05-27 Thread Ales Kvapil
method to merge patterns (similar to re.escape)? -- components: Regular Expressions messages: 317787 nosy: aleskva, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: Introduce a method to concatenate regex patterns type: enhancement versions: Pyth

[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This change is documented in the subsection "Changes in the Python API" of the section "Porting to Python 3.7". -- ___ Python tracker

[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Ville Skyttä
Ville Skyttä added the comment: Oh, I see, sorry about the noise, then. (Only looked at the "Improved Modules" -> re section in the what's new, thus missed the doc.) -- ___ Python tracker

[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is expected behavior and documented change in 3.7. The pattern ".*" can match an empty string, and it matches an empty string at the end of line. This behavior is consistent with the behavior of re.finditer() and with the

[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Ville Skyttä
Ville Skyttä added the comment: Right, it's not limited to repl functions. Python 3.6.3: $ python -c 'import re;print(re.sub(".*", "X", "foo"))' X Python 3.7.0b4+: $ python -c 'import re;print(re.sub(".*", "X", "foo"))' XX Poking serhiy.storchaka who according to the

[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Ville Skyttä
Change by Ville Skyttä : -- components: +Regular Expressions nosy: +ezio.melotti, mrabarnett ___ Python tracker ___

[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Ville Skyttä
time too many, when given a catch-all regex. The extra call is made with a match consisting of an empty string. I think this is quite unexpected, and think it's a bug that I hope could be fixed before 3.7 is out. Demonstration code: import re def repl(match): print(f"Called

Re: I need help with this python regex

2018-04-28 Thread Peter J. Holzer
On 2018-04-27 21:04:49 -0700, Ed Manning wrote: > Here is the source code. > > > import re > > > log = open("csg.txt", "r") # Opens a file call session.txt > regex = re.compile(r'policy id \d+') # search for the policy ID > regex1 = re.compi

I need help with this python regex

2018-04-27 Thread Ed Manning
Here is the source code. import re log = open("csg.txt", "r") # Opens a file call session.txt regex = re.compile(r'policy id \d+') # search for the policy ID regex1 = re.compile(r'log count \d+') # search for the policy ID for match in log: x = regex.findall(match)

Re: Regex for changing :variable to ${variable} in sql query

2018-04-18 Thread zljubisic
On Wednesday, 18 April 2018 19:34:37 UTC+2, MRAB wrote: > > Hi, > > > > I have a sql query in which all variables declared as :variable should be > > changed to ${variable}. > > > > for example this sql: > > > > select * > > from table > > where ":x" = "1" and :y=2 > > and field in

Re: Regex for changing :variable to ${variable} in sql query

2018-04-18 Thread MRAB
On 2018-04-18 08:25, zljubi...@gmail.com wrote: Hi, I have a sql query in which all variables declared as :variable should be changed to ${variable}. for example this sql: select * from table where ":x" = "1" and :y=2 and field in (:string) and time between :from and :to should be

Regex for changing :variable to ${variable} in sql query

2018-04-18 Thread zljubisic
Hi, I have a sql query in which all variables declared as :variable should be changed to ${variable}. for example this sql: select * from table where ":x" = "1" and :y=2 and field in (:string) and time between :from and :to should be translated to: select * from table where "${x}"

RE: Python regex pattern from array of hex chars

2018-04-13 Thread Joseph L. Casale
-Original Message- From: Python-list On Behalf Of MRAB Sent: Friday, April 13, 2018 12:05 PM To: python-list@python.org Subject: Re: Python regex pattern from array of hex chars > Use re.escape: > > regex = re.compile('[^{}]+'.format(re.escape(''.join(c for c in > cha

Re: Python regex pattern from array of hex chars

2018-04-13 Thread MRAB
On 2018-04-13 18:28, Joseph L. Casale wrote: I have an array of hex chars which designate required characters. and one happens to be \x5C or "\". What foo is required to build the pattern to exclude all but: regex = re.compile('[^{}]+'.format(''.join(c for c in character_class))) I

Python regex pattern from array of hex chars

2018-04-13 Thread Joseph L. Casale
I have an array of hex chars which designate required characters. and one happens to be \x5C or "\". What foo is required to build the pattern to exclude all but: regex = re.compile('[^{}]+'.format(''.join(c for c in character_class))) I would use that in a re.sub to collapse and r

Re: RegEx to match set of lines

2018-04-05 Thread Terry Reedy
hundreds of lines. +100 Cut your data down to a SMALL representative sample. Explain how it is coming to you: it looks like you are reading the data in something similar to key:value format. Is that correct? If so, you don't need a regex. This is not Perl, we have more than one tool in our toolbox

Re: RegEx to match set of lines

2018-04-05 Thread Steven D'Aprano
data down to a SMALL representative sample. Explain how it is coming to you: it looks like you are reading the data in something similar to key:value format. Is that correct? If so, you don't need a regex. This is not Perl, we have more than one tool in our toolbox and don't have to force e

RegEx to match set of lines

2018-04-05 Thread Prahallad Achar
Hello, I would like to match set of lines from the below data. this data comes from one of the network Part of data : [ If circuit type is OCHCC then I need Circuit name and service ID from that group ] Circuit ID: ad8a0165:25 *Circuit Name: T3A_100G_SD20* Circuit Version: 0 Circuit Monitor:

Re: Regex Doubts

2018-03-30 Thread Iranna Mathapati
free > > <<<< > Feature XYZ : 3 valid13 free > > Feature PQR : 0 valid 16 free > > Feature MNO : 0 valid 2 free > > > > """ > > > > i am going t

Re: Regex Doubts

2018-03-30 Thread Antoon Pardon
: 0 valid 2 free > > """ > > i am going to grep MEM values alone and i have tried fallowing Regex: > > re.findall(r'MEMR\s+\:\s+([0-9]+)\s+valid \s+([0-9]+)\s+free ', str_output) > > it produce fallowing output:: > [('0', '0'), ('

Re: Regex Doubts

2018-03-30 Thread Cameron Simpson
On 30Mar2018 11:46, Iranna Mathapati wrote: how to achieve fallowing expected output? str_output= """ MOD1 memory : 2 valid1790 free MOD2 memory : 128 valid 128 free UDP Aware *MEMR*

Re: Regex Doubts

2018-03-30 Thread Iranna Mathapati
ature PQR : 0 valid 16 free >> Feature MNO: 0 valid 2 free >> >> """ >> >> i am going to grep MEM values alone and i have tried fallowing Regex: >> >> re.findall(r'MEMR\s+\:\s+([0-9]+)\s+valid \s

Regex Doubts

2018-03-30 Thread Iranna Mathapati
Hi Team, how to achieve fallowing expected output? str_output= """ MOD1 memory : 2 valid1790 free MOD2 memory : 128 valid 128 free UDP Aware *MEMR*: 0 valid 0 free *MEMR

Re: Regex on a Dictionary

2018-02-15 Thread Andre Müller
Hello, this question also came up there: https://python-forum.io/Thread-Working-with-Dict-Object Greetings Andre -- https://mail.python.org/mailman/listinfo/python-list

Re: Regex on a Dictionary

2018-02-13 Thread Mark Lawrence
On 13/02/18 18:08, Stanley Denman wrote: On Tuesday, February 13, 2018 at 9:41:14 AM UTC-6, Mark Lawrence wrote: On 13/02/18 13:11, Stanley Denman wrote: I am trying to performance a regex on a "string" of text that python isinstance is telling me is a dictionary. When I run the

Re: Regex on a Dictionary

2018-02-13 Thread Stanley Denman
On Tuesday, February 13, 2018 at 9:41:14 AM UTC-6, Mark Lawrence wrote: > On 13/02/18 13:11, Stanley Denman wrote: > > I am trying to performance a regex on a "string" of text that python > > isinstance is telling me is a dictionary. When I run the code I get

Re: Regex on a Dictionary

2018-02-13 Thread Steven D'Aprano
On Tue, 13 Feb 2018 13:53:04 +, Mark Lawrence wrote: > Was the string methods solution that I gave a week or so ago so bad that > you still think that you need a regex to solve this? Sometimes regexes are needed, but often Jamie Zawinski is right: Some people, when conf

Re: Regex on a Dictionary

2018-02-13 Thread Steven D'Aprano
On Tue, 13 Feb 2018 05:11:20 -0800, Stanley Denman wrote: > I am trying to performance a regex on a "string" of text that python > isinstance is telling me is a dictionary. Please believe Python when it tells you that something is a dictionary. Trust me, the interpreter knows. I

Re: Regex on a Dictionary

2018-02-13 Thread Mark Lawrence
On 13/02/18 13:11, Stanley Denman wrote: I am trying to performance a regex on a "string" of text that python isinstance is telling me is a dictionary. When I run the code I get the following error: {'/Title': '1F: Progress Notes Src.: MILANI, JOHN C Tmt. Dt.: 05/12/2014 - 05/

Re: Regex on a Dictionary

2018-02-13 Thread alister via Python-list
On Tue, 13 Feb 2018 13:42:08 +, Rhodri James wrote: > On 13/02/18 13:11, Stanley Denman wrote: >> I am trying to performance a regex on a "string" of text that python >> isinstance is telling me is a dictionary. When I run the code I get >> the followi

Re: Regex on a Dictionary

2018-02-13 Thread Rhodri James
On 13/02/18 13:11, Stanley Denman wrote: I am trying to performance a regex on a "string" of text that python isinstance is telling me is a dictionary. When I run the code I get the following error: {'/Title': '1F: Progress Notes Src.: MILANI, JOHN C Tmt. Dt.: 05/12/2014 - 05/

Re: Regex on a Dictionary

2018-02-13 Thread Etienne Robillard
Hi Stanley, Le 2018-02-13 à 08:11, Stanley Denman a écrit : x=MyRegex.findall(MyDict) How about: x = [MyRegex.findall(item) for item in MyDict] Etienne -- Etienne Robillard tkad...@yandex.com https://www.isotopesoftware.ca/ -- https://mail.python.org/mailman/listinfo/python-list

Regex on a Dictionary

2018-02-13 Thread Stanley Denman
I am trying to performance a regex on a "string" of text that python isinstance is telling me is a dictionary. When I run the code I get the following error: {'/Title': '1F: Progress Notes Src.: MILANI, JOHN C Tmt. Dt.: 05/12/2014 - 05/28/2014 (9 pages)', '/Page': IndirectObj

[issue30157] csv.Sniffer.sniff() regex error

2018-02-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your contribution Jake! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue30157] csv.Sniffer.sniff() regex error

2018-02-09 Thread Serhiy Storchaka
Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment: New changeset 504f19145ca5738162d6a720fa45b364ac8c0384 by Serhiy Storchaka in branch '3.6': [3.6] bpo-30157: Fix csv.Sniffer.sniff() regex pattern. (GH-5601) (GH-5603) https://github.com/python/cpython/

[issue30157] csv.Sniffer.sniff() regex error

2018-02-09 Thread Serhiy Storchaka
Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment: New changeset e7197936c987bdf31b6b7b1dab275d1a762e03b3 by Serhiy Storchaka in branch '2.7': [2.7] bpo-30157: Fix csv.Sniffer.sniff() regex pattern. (GH-5601) (GH-5604) https://github.com/python/cpython/

[issue30157] csv.Sniffer.sniff() regex error

2018-02-09 Thread Serhiy Storchaka
Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment: New changeset 2ef69a1d45de8aa41c45d32d9ee1ff227bb1a566 by Serhiy Storchaka (Miss Islington (bot)) in branch '3.7': bpo-30157: Fix csv.Sniffer.sniff() regex pattern. (GH-5601) (GH-5602) https://github.com/python/cpython/

[issue30157] csv.Sniffer.sniff() regex error

2018-02-09 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +5416 ___ Python tracker ___ ___

[issue30157] csv.Sniffer.sniff() regex error

2018-02-09 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +5415 ___ Python tracker ___ ___

[issue30157] csv.Sniffer.sniff() regex error

2018-02-09 Thread miss-islington
Change by miss-islington : -- pull_requests: +5414 ___ Python tracker ___

[issue30157] csv.Sniffer.sniff() regex error

2018-02-09 Thread Serhiy Storchaka
Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment: New changeset 2411292ba8155327125d8a1da8a4c9fa003d5909 by Serhiy Storchaka in branch 'master': bpo-30157: Fix csv.Sniffer.sniff() regex pattern. (GH-5601) https://github.com/python/cpython/

[issue30157] csv.Sniffer.sniff() regex error

2018-02-09 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- versions: +Python 3.8 -Python 3.3, Python 3.4, Python 3.5 ___ Python tracker ___

[issue30157] csv.Sniffer.sniff() regex error

2018-02-09 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +5413 stage: -> patch review ___ Python tracker ___

[issue30157] csv.Sniffer.sniff() regex error

2018-02-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Since the original author didn't respond for long time I have recreated PR 1273 as PR 5601. -- nosy: +serhiy.storchaka ___ Python tracker

Re: What is wrong with this regex for matching emails?

2017-12-21 Thread Peter J. Holzer
On 2017-12-20 08:21:02 +1100, Chris Angelico wrote: > If there are no MX records for a domain, either the domain doesn't > exist, or it doesn't receive mail. This is not necessarily correct. An MTA has to fall back to A and records if no MX record exists, so a domain can receive mail without

Re: What is wrong with this regex for matching emails?

2017-12-19 Thread Random832
On Mon, Dec 18, 2017, at 02:01, Chris Angelico wrote: > Hmm, is that true? I was under the impression that the quoting rules > were impossible to match with a regex. Or maybe it's just that they're > impossible to match with a *standard* regex, but the extended > implementation

Re: What is wrong with this regex for matching emails?

2017-12-19 Thread alister via Python-list
On Wed, 20 Dec 2017 08:21:02 +1100, Chris Angelico wrote: > On Wed, Dec 20, 2017 at 7:21 AM, alister via Python-list > wrote: >> On Mon, 18 Dec 2017 07:57:27 +1100, Ben Finney wrote: >>> A more correct match would boil down to: >>> >>> * Match any printable Unicode

Re: What is wrong with this regex for matching emails?

2017-12-19 Thread Chris Angelico
On Wed, Dec 20, 2017 at 7:21 AM, alister via Python-list wrote: > On Mon, 18 Dec 2017 07:57:27 +1100, Ben Finney wrote: >> A more correct match would boil down to: >> >> * Match any printable Unicode characters (not just ASCII). >> >> * Locate the *last* ‘@’ character. (An

Re: What is wrong with this regex for matching emails?

2017-12-19 Thread alister via Python-list
On Mon, 18 Dec 2017 07:57:27 +1100, Ben Finney wrote: > Peng Yu writes: > >> Hi, >> >> I would like to extract "a...@efg.hij.xyz". But it only shows ".hij". > > Others have address this question. I'll answer a separate one: > >> Does anybody see what is wrong with it?

Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Chris Angelico
l >> address included - then my recommendation is simply DON'T. You can't >> get all the edge cases right; it is actually impossible for a regex to >> perfectly match every valid email address and no invalid addresses. > > That's not actually true (the thing that notoriously c

Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Random832
e edge cases right; it is actually impossible for a regex to > perfectly match every valid email address and no invalid addresses. That's not actually true (the thing that notoriously can't be matched in a regex, RFC822 "address", is basically most of the syntax of the To: header - the

Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Ben Finney
Peng Yu writes: > Hi, > > I would like to extract "a...@efg.hij.xyz". But it only shows ".hij". Others have address this question. I'll answer a separate one: > Does anybody see what is wrong with it? Thanks. One thing that's wrong with it is that it is far too

Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Ned Batchelder
On 12/17/17 10:29 AM, Peng Yu wrote: Hi, I would like to extract "a...@efg.hij.xyz". But it only shows ".hij". Does anybody see what is wrong with it? Thanks. $ cat main.py #!/usr/bin/env python # vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8: import re

Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Chris Angelico
s okay to miss out some edge cases, and for that, I would recommend keeping your regex REALLY simple - something like you have above, but maybe even simpler. (And I wouldn't have the parentheses in there, which I think might be what you're getting tripped up on.) But if you're trying to *validate* an

What is wrong with this regex for matching emails?

2017-12-17 Thread Peng Yu
Hi, I would like to extract "a...@efg.hij.xyz". But it only shows ".hij". Does anybody see what is wrong with it? Thanks. $ cat main.py #!/usr/bin/env python # vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8: import re email_regex =

[issue2636] Adding a new regex module (compatible with re)

2017-12-09 Thread petros
Change by petros : -- nosy: +petros ___ Python tracker ___ ___ Python-bugs-list mailing

[issue3262] re.split doesn't split with zero-width regex

2017-12-02 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +4589 ___ Python tracker ___ ___

[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Cristian for reporting this issue. Thank you Mandeep for your patch. Thank you Mariatta for merging. -- ___ Python tracker

[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Mariatta Wijaya
Mariatta Wijaya added the comment: Thanks everyone. I merged the PR, and it's been backported to 3.6 and 2.7 -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Mariatta Wijaya
Mariatta Wijaya <mariatta.wij...@gmail.com> added the comment: New changeset 3e60747025edc34b503397ab8211be59cfdd05cd by Mariatta (Miss Islington (bot)) in branch '3.6': bpo-30004: Fix the code example of using group in Regex Howto Docs (GH-4443) (GH-4554) https://github.com/python/c

[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Mariatta Wijaya
Mariatta Wijaya <mariatta.wij...@gmail.com> added the comment: New changeset c02037d62284f4d4ca6b22f2ed05165ce2014951 by Mariatta (Miss Islington (bot)) in branch '2.7': bpo-30004: Fix the code example of using group in Regex Howto Docs (GH-4443) (GH-4555) https://github.com/python/c

[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Roundup Robot
Change by Roundup Robot : -- pull_requests: +4486 ___ Python tracker ___

[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Roundup Robot
Change by Roundup Robot : -- pull_requests: +4485 ___ Python tracker ___

[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Mariatta Wijaya
Mariatta Wijaya <mariatta.wij...@gmail.com> added the comment: New changeset 610e5afdcbe3eca906ef32f4e0364e20e1b1ad23 by Mariatta (Mandeep Bhutani) in branch 'master': bpo-30004: Fix the code example of using group in Regex Howto Docs (GH-4443) https://github.com/python/cpython/

[issue3262] re.split doesn't split with zero-width regex

2017-11-19 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +4406 ___ Python tracker ___ ___

<    1   2   3   4   5   6   7   8   9   10   >