Newbie Need Help On Regex!

2016-10-10 Thread infosecflag
Hey guys! I am new to learning regex in python and I'm wondering how do I use regex in python to store the integers(positive and negative) i want into a list! For e.g. This is the data in a list. [u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=-5,B=5)', u'\x1b[0m[\x1b[1m\x1b[0m

[issue28293] Don't completely dump the regex cache when full

2016-09-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The re module now depends on the enum module, and the latter already depends on OrderedDict. Thus the patch doesn't introduce new dependency. Python implementation of OrderedDict doesn't override __getitem__ and therefore don't slow down the common case. I

[issue28293] Don't completely dump the regex cache when full

2016-09-28 Thread Raymond Hettinger
, minimalistic change or just drop it. Really, its too bad that the regex got contorted in a way that precluded the use of the lru_cache (DEBUG isn't the central feature of regex and is only minimally useful). -- ___ Python tracker <rep...@bugs.python.

[issue28293] Don't completely dump the regex cache when full

2016-09-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is applied cleanly on the default branch. I don't think there is a need to open a new issue. The last patch implements the original Raymond's intention, but taking into account all comments: drops the oldest item, doesn't depend on implementation details

[issue28293] Don't completely dump the regex cache when full

2016-09-28 Thread SilentGhost
SilentGhost added the comment: Serhiy, your patch doesn't seem to apply cleanly. Also, it's perhaps worth opening the issue if you'd like to continue working on it. -- nosy: +SilentGhost ___ Python tracker

[issue28293] Don't completely dump the regex cache when full

2016-09-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Why not OrderedDict.popitem(last=False)? Yes, this should work. Here is a patch. -- Added file: http://bugs.python.org/file44855/re_cache_ordered_dict_popitem.patch ___ Python tracker

[issue28293] Don't completely dump the regex cache when full

2016-09-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: This has gotten crazy. I withdraw the suggestion. -- resolution: -> rejected status: open -> closed ___ Python tracker

[issue28293] Don't completely dump the regex cache when full

2016-09-28 Thread Xiang Zhang
Xiang Zhang added the comment: Why not OrderedDict.popitem(last=False)? -- ___ Python tracker ___ ___

[issue28293] Don't completely dump the regex cache when full

2016-09-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Maybe use OrderedDict? But this adds heavy dependency to the re module. We can use the same trick as in the enum module. Here is a patch. -- Added file: http://bugs.python.org/file44854/re_cache_ordered_dict_del_first.patch

[issue28293] Don't completely dump the regex cache when full

2016-09-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Perhaps: _cache.pop(next(iter(_cache))) This can raise KeyError if the cache is cleared in other thread. And it is a little slower. I remember why I didn't propose this idea earlier. This depends on the ordering of dict. But this is implementation

[issue28293] Don't completely dump the regex cache when full

2016-09-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: Perhaps: _cache.pop(next(iter(_cache))) The for-loop version indirect about what it is trying to do and relies on an obscure quirk of exactly when it is an error to mutate while iterating. I do like that the side-effect of the compact dict is that is lets

[issue28293] Don't completely dump the regex cache when full

2016-09-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Nice catch! Here is a patch that deletes the first key. -- stage: commit review -> patch review Added file: http://bugs.python.org/file44853/re_cache_del_first.patch ___ Python tracker

[issue28293] Don't completely dump the regex cache when full

2016-09-27 Thread Xiang Zhang
Xiang Zhang added the comment: But with the compact dict implementation, popitem is not going to evict an arbitrary entry but always the last one. Will this cause two interchangeably used regexes always need to recompile? -- nosy: +xiang.zhang ___

[issue28293] Don't completely dump the regex cache when full

2016-09-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: LGTM. -- assignee: serhiy.storchaka -> rhettinger stage: patch review -> commit review ___ Python tracker ___

[issue28293] Don't completely dump the regex cache when full

2016-09-27 Thread Raymond Hettinger
New submission from Raymond Hettinger: When the regex cache gets filled, it is cleared in its entirety. Instead, it only needs to evict one arbitrary entry. This will save the us from having to rebuild and recache frequently used regexes. -- assignee: serhiy.storchaka components

[issue28136] RegEx documentation error

2016-09-13 Thread triuan
triuan added the comment: thanks! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28136] RegEx documentation error

2016-09-13 Thread SilentGhost
Changes by SilentGhost : -- resolution: -> not a bug stage: -> resolved status: open -> closed type: -> behavior ___ Python tracker

[issue28136] RegEx documentation error

2016-09-13 Thread Christian Heimes
Christian Heimes added the comment: The documentation is correct. It explains the difference between a default match (greedy) and a non-greedy match. >>> re.match('(a{3,5})', 'a').group(1) 'a' >>> re.match('(a{3,5}?)', 'a').group(1) 'aaa' -- nosy: +christian.heimes

[issue28136] RegEx documentation error

2016-09-13 Thread triuan
triuan added the comment: https://docs.python.org/2/library/re.html error: ...string 'aa', a{3,5} will match 5 'a' characters... suggest correction 2: ...string 'aa', a{3, 5} will match 3 to 5 'a' characters... -- ___ Python tracker

[issue28136] RegEx documentation error

2016-09-13 Thread triuan
: docs@python, triuan priority: normal severity: normal status: open title: RegEx documentation error ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue26436] Add the regex-dna benchmark

2016-09-13 Thread STINNER Victor
STINNER Victor added the comment: Serhiy: Can you please open a pull request on the new performance module? https://github.com/python/performance -- nosy: +haypo ___ Python tracker

[issue27952] Finish converting fixcid.py from regex to re

2016-09-12 Thread Berker Peksag
Berker Peksag added the comment: Done. I'm going to pretend 2.7 doesn't exist :) -- nosy: +berker.peksag status: open -> closed ___ Python tracker ___

[issue27952] Finish converting fixcid.py from regex to re

2016-09-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5ae3782c4e05 by Berker Peksag in branch '3.5': Issue #27952: Capture stderr in run_script() https://hg.python.org/cpython/rev/5ae3782c4e05 New changeset 33d118a27035 by Berker Peksag in branch '3.6': Issue #27952: Merge from 3.5

[issue27952] Finish converting fixcid.py from regex to re

2016-09-12 Thread Xiang Zhang
Xiang Zhang added the comment: Can we silence the debug output? ./python -m test test_tools Run tests sequentially 0:00:00 [1/1] test_tools *recursedown('@test_20410_tmp') 1 test OK. Total duration: 4 sec Tests result: SUCCESS -- nosy: +xiang.zhang status: closed -> open

Re: more python3 regex?

2016-09-11 Thread Doug OLeary
Hey, all; The print suggestion was the key clue. Turned out my loop was slurping the whole of data in one big line. Searching for a line that begins with Name when it's in the middle of the string is... obviously not going to work so well. Took me a bit to get that working and, once I did, I

Re: more python3 regex?

2016-09-11 Thread Lawrence D’Oliveiro
On Monday, September 12, 2016 at 6:21:57 AM UTC+12, Peter Otten wrote: > By the way, many simple text-processing problems can be solved without > regular expressions. The old JWZ quote instantly comes to mind... -- https://mail.python.org/mailman/listinfo/python-list

Re: more python3 regex?

2016-09-11 Thread Peter Otten
make your own debugging experience more pleasant ;) Had you tried $ cat oleary.py import re lines = """\ foo show "bar" skip Name skip Name show "baz" show baz show """.splitlines() for line in lines: if re.match(r'^(Name|")', line):

more python3 regex?

2016-09-11 Thread Doug OLeary
Hey This one seems like it should be easy but I'm not getting the expected results. I have a chunk of data over which I can iterate line by line and print out the expected results: for l in q.findall(data): # if re.match(r'(Name|")', l): # continue print(l) $ ./testies.py | wc -l

[issue27952] Finish converting fixcid.py from regex to re

2016-09-11 Thread Martin Panter
Changes by Martin Panter : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue27952] Finish converting fixcid.py from regex to re

2016-09-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 740e43eb8138 by Martin Panter in branch '2.7': Issue #27952: Get fixcid.py working with the re module https://hg.python.org/cpython/rev/740e43eb8138 New changeset ca68bb597df9 by Martin Panter in branch '3.5': Issue #27952: Get fixcid.py working

Re: python3 regex?

2016-09-10 Thread Doug OLeary
Hey, all; thanks for the replies - reading data in one slurp vs line by line was the issue. In my perl programs, when reading files, I generally do it all in one swell foop and will probably end up doing so again in this case due to the layout of the text; but, that's my issue. Thanks again.

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-10 Thread Rustom Mody
On Saturday, September 10, 2016 at 3:56:37 PM UTC+5:30, Veek 'this_is_not_my_name' M wrote: > Veek 'this_is_not_my_name' M wrote: Recursion… Self-Reference…Inversion Heh! On the way to becoming another Gödel/Turing?? You may be interested in this collection of some evidence(s) of recursion

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-10 Thread Tim Golden
On 10/09/2016 11:26, Veek 'this_is_not_my_name' M wrote: Veek 'this_is_not_my_name' M wrote: /me claps TJG -- https://mail.python.org/mailman/listinfo/python-list

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-10 Thread Veek 'this_is_not_my_name' M
Veek 'this_is_not_my_name' M wrote: > Rustom Mody wrote: > >> On Saturday, September 3, 2016 at 5:25:48 PM UTC+5:30, Veek. M wrote: >>> https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm >>> >>> Wanted to know if the above link idea, had been implemented and if >>> there's

Re: python3 regex?

2016-09-10 Thread breamoreboy
On Saturday, September 10, 2016 at 4:12:17 AM UTC+1, Doug OLeary wrote: > Hey; > > Long term perl ahderent finally making the leap to python. From my reading, > python, for the most part, uses perl regex.. except, I can't seem to make it > work... > > I have a txt file

Re: python3 regex?

2016-09-10 Thread Jussi Piitulainen
Jussi Piitulainen writes: > dkole...@olearycomputers.com writes: >> [- -] > import re > p = re.compile('"?[1-9]*\.') That should be a raw string: r'"?[1-9]*\.' Sorry about that. I wish Python would complain. -- https://mail.python.org/mailman/listinfo/python-list

Re: python3 regex?

2016-09-10 Thread Jussi Piitulainen
dkole...@olearycomputers.com writes: > Hey; > > Long term perl ahderent finally making the leap to python. From my > reading, python, for the most part, uses perl regex.. except, I can't > seem to make it work... > > I have a txt file from which I can grab specific titles v

Re: python3 regex?

2016-09-09 Thread Christian Gollwitzer
Am 10.09.16 um 05:12 schrieb dkole...@olearycomputers.com: Hey; Long term perl ahderent finally making the leap to python. From my reading, python, for the most part, uses perl regex.. except, I can't seem to make it work... I have a txt file from which I can grab specific titles via a perl

Re: python3 regex?

2016-09-09 Thread Lawrence D’Oliveiro
On Saturday, September 10, 2016 at 3:12:17 PM UTC+12, Doug OLeary wrote: > $ perl -ne 'print if (m{^("?)[1-9]*\.})' tables Perl has this feature of being able to use alternate delimiter symbols for the pattern; Python does not. > >>> regex = r'^("?)[1-9]*\.' Try put

[issue27952] Finish converting fixcid.py from regex to re

2016-09-09 Thread Martin Panter
Martin Panter added the comment: New patch with more fixes and test cases. Also dropped some of the less useful raw string changes. -- Added file: http://bugs.python.org/file44521/fixcid-re.v2.patch ___ Python tracker

python3 regex?

2016-09-09 Thread dkoleary
Hey; Long term perl ahderent finally making the leap to python. From my reading, python, for the most part, uses perl regex.. except, I can't seem to make it work... I have a txt file from which I can grab specific titles via a perl one-liner: $ perl -ne 'print if (m{^("?)[1-9]*\.})' t

[issue27952] Finish converting fixcid.py from regex to re

2016-09-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thanks Martin. The patch in general LGTM, but see comments on Rietveld. -- ___ Python tracker ___

[issue27952] Finish converting fixcid.py from regex to re

2016-09-09 Thread Martin Panter
Martin Panter added the comment: It would be nice to fix this so that the tests pass with -Werror. Here is a quick patch: * Fix the deprecated non-escapes * Make all the regular expressions raw strings * Fix bugs with parsing escaped quotes in C strings and char literals * Adapt from old regex

Re: Extend unicodedata with a name/pattern/regex search for character

2016-09-06 Thread jladasky
From: jlada...@itu.edu On Saturday, September 3, 2016 at 7:49:14 PM UTC-7, Steve D'Aprano wrote: > On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote: > > Killfile him and move on... > > But but but... I couldn't do that. > > https://www.xkcd.com/386/ I strongly suspected it would be that

Re: Extend unicodedata with a name/pattern/regex search for character

2016-09-06 Thread jladasky
On Saturday, September 3, 2016 at 7:49:14 PM UTC-7, Steve D'Aprano wrote: > On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote: > > Killfile him and move on... > > But but but... I couldn't do that. > > https://www.xkcd.com/386/ I strongly suspected it would be that particular XKCD. :^) --

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-06 Thread jladasky
On Saturday, September 3, 2016 at 7:49:14 PM UTC-7, Steve D'Aprano wrote: > On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote: > > Killfile him and move on... > > But but but... I couldn't do that. > > https://www.xkcd.com/386/ I strongly suspected it would be that particular XKCD. :^) --

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-06 Thread Veek 'this_is_not_my_name' M
Rustom Mody wrote: > On Saturday, September 3, 2016 at 5:25:48 PM UTC+5:30, Veek. M wrote: >> https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm >> >> Wanted to know if the above link idea, had been implemented and if >> there's a module that accepts a pattern like 'cap' and

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-05 Thread Ned Batchelder
On Monday, September 5, 2016 at 2:15:58 AM UTC-4, Thomas 'PointedEars' Lahn wrote: > How can I trust a person > who does not even have the decency and the courage to stand by their > statements with their real name? Feel free to ignore people you don't trust. We'll help them. --Ned. --

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-05 Thread alister
On Mon, 05 Sep 2016 08:15:42 +0200, Thomas 'PointedEars' Lahn wrote: > >> So Veek should be able to appease P.E. by calling himself 'Veek "David >> Smith" M'. > > That would not help. “Veek” might be (the transcription of) a given > name or a family name, but “Veek M” is not a real name.

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-05 Thread Veek. M
Thomas 'PointedEars' Lahn wrote: > Gregory Ewing wrote: > >> Larry Hudson wrote: >>> If you continue to read this forum, you will quickly learn to ignore >>> "Pointy-Ears". He rarely has anything worth while to post, and his >>> unique fetish about Real Names shows him to be a hypocrite as

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Michael Torrie
On 09/04/2016 04:22 PM, Gregory Ewing wrote: > Larry Hudson wrote: >> If you continue to read this forum, you will quickly learn to ignore >> "Pointy-Ears". He rarely has anything worth while to post, and his >> unique fetish about Real Names shows him to be a hypocrite as well. > > To be

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Ned Batchelder
On Sunday, September 4, 2016 at 7:52:44 PM UTC-4, Chris Angelico wrote: > FWIW, hex is much more common for displaying Unicode codepoints than > decimal is. So I'd print it like this (incorporating the 'not CAPITAL' > filter): You are right, I went too quickly, and didn't realize until after I

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Chris Angelico
On Mon, Sep 5, 2016 at 9:40 AM, Ned Batchelder wrote: > But, 'CAP' appears in 'CAPITAL', which gives more than 1800 matches: > > >>> for c in range(32, 0x11): > ... try: > ... name = unicodedata.name(chr(c)) > ... except ValueError: > ...

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Ned Batchelder
hich does not do globs, regexs - so it's > kind of limiting in nature. > > Would be nice if you could search html/xml character entity references > as well. The unicodedata module has all the information you need for searching Unicode character names. While it doesn't provide regex or g

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Gregory Ewing
Larry Hudson wrote: If you continue to read this forum, you will quickly learn to ignore "Pointy-Ears". He rarely has anything worth while to post, and his unique fetish about Real Names shows him to be a hypocrite as well. To be fair, it's likely that Thomas Lahn is his real name, and he's

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Larry Hudson via Python-list
On 09/04/2016 09:00 AM, Veek. M wrote: Steve D'Aprano wrote: On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote: Regarding the name (From field), my name *is* Veek.M […] Liar. *plonk* You have crossed a line now Thomas. That is absolutely uncalled for. You have absolutely no

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Veek. M
Steve D'Aprano wrote: > On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote: > >>> Regarding the name (From field), my name *is* Veek.M […] >> >> Liar. *plonk* > > You have crossed a line now Thomas. > > That is absolutely uncalled for. You have absolutely no legitimate > reason to

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Steve D'Aprano
On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote: >> Regarding the name (From field), my name *is* Veek.M […] > > Liar. *plonk* You have crossed a line now Thomas. That is absolutely uncalled for. You have absolutely no legitimate reason to believe that Veek is not his or her real

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Rustom Mody
On Sunday, September 4, 2016 at 11:18:07 AM UTC+5:30, Rustom Mody wrote: > On Sunday, September 4, 2016 at 9:32:28 AM UTC+5:30, Veek. M wrote: > > Regarding the name (From field), my name *is* Veek.M though I tend to > > shorten it to Vek.M on Google (i think Veek was taken or some such > >

[issue27952] Finish converting fixcid.py from regex to re

2016-09-04 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Tools/scripts/fixcid.py initially used old regex module. In 4727f260f6f8 it was converted to using new re module, but not all generated regular expressions were converted to new syntax. The script is not working since that time. -- components

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Jussi Piitulainen
Chris Angelico writes: > On Sun, Sep 4, 2016 at 12:49 PM, Steve D'Aprano > wrote: >> On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote: >> >> [...] Please either comply, or give up your stupid and pointless obsession with trying to be the

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Rustom Mody
On Sunday, September 4, 2016 at 9:32:28 AM UTC+5:30, Veek. M wrote: > Regarding the name (From field), my name *is* Veek.M though I tend to > shorten it to Vek.M on Google (i think Veek was taken or some such > thing). Just to be clear, my parents call me something closely related > to Veek

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Rustom Mody
On Saturday, September 3, 2016 at 5:25:48 PM UTC+5:30, Veek. M wrote: > https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm > > Wanted to know if the above link idea, had been implemented and if > there's a module that accepts a pattern like 'cap' and give you all the >

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Veek. M
Thomas 'PointedEars' Lahn wrote: > Veek. M wrote: > >> https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm >> >> Wanted to know if the above link idea, > > … which is 404-compliant; the Internet Archive does not have it either > … > >> had been implemented > > Probably

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Chris Angelico
On Sun, Sep 4, 2016 at 12:49 PM, Steve D'Aprano wrote: > On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote: > > [...] >>> Please either comply, or give up your stupid and pointless obsession with >>> trying to be the Internet Police for something that isn't even a real

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Steve D'Aprano
On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote: [...] >> Please either comply, or give up your stupid and pointless obsession with >> trying to be the Internet Police for something that isn't even a real >> rule. > > His posts aren't making it across the news->list gateway any more. >

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Chris Angelico
On Sun, Sep 4, 2016 at 11:51 AM, Steve D'Aprano wrote: > On Sun, 4 Sep 2016 06:47 am, Thomas 'PointedEars' Lahn wrote: > >> Your posting is lacking a real name in the “From” header field. > > > Thomas, if that is really your name, how do we know that: > > Thomas

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Steve D'Aprano
On Sun, 4 Sep 2016 06:47 am, Thomas 'PointedEars' Lahn wrote: > Your posting is lacking a real name in the “From” header field. Thomas, if that is really your name, how do we know that: Thomas 'PointedEars' Lahn is a real name? Is sounds made up to me. I'm afraid that we're going to have

Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Veek. M
https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm Wanted to know if the above link idea, had been implemented and if there's a module that accepts a pattern like 'cap' and give you all the instances of unicode 'CAP' characters. ⋂ \bigcap ⊓ \sqcap ∩ \cap ♑ \capricornus

Re: use regex to search the page one time to get two types of Information

2016-08-20 Thread iMath
On Friday, August 19, 2016 at 9:45:08 PM UTC+8, Friedrich Rentsch wrote: > On 08/19/2016 09:02 AM, iMath wrote: > > I need to use regex to search two types of Information within a web page, > > while it seems searching the page two times rather than one is much time

Re: use regex to search the page one time to get two types of Information

2016-08-20 Thread iMath
ignore it. You're searching a web > page; if you're downloading that before you search it, chances are > very good that you spend far more time waiting for the download than > you ever will on the regex. > > ChrisA tested, searching the page two times rather than one is

Re: use regex to search the page one time to get two types of Information

2016-08-19 Thread Friedrich Rentsch
On 08/19/2016 09:02 AM, iMath wrote: I need to use regex to search two types of Information within a web page, while it seems searching the page two times rather than one is much time consuming , is it possible to search the page one time to get two or more types of Information? >&

Re: use regex to search the page one time to get two types of Information

2016-08-19 Thread Chris Angelico
ces are very good that you spend far more time waiting for the download than you ever will on the regex. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: use regex to search the page one time to get two types of Information

2016-08-19 Thread iMath
1. searching the page two times rather than one is a little bit time consuming . 2. starting the second search from the first match.endpos does reduce the time consuming . 3. how to combine both patterns into one regex? while using the special | regex operator only matches one regex not both

Re: use regex to search the page one time to get two types of Information

2016-08-19 Thread Peter Otten
iMath wrote: > I need to use regex to search two types of Information within a web page, Did you try specialised tools like BeautifulSoup? > while it seems searching the page two times rather than one is much time > consuming It "seems"? Try it and only "fix" it

Re: use regex to search the page one time to get two types of Information

2016-08-19 Thread iMath
each regex only has one matched result in the web page -- https://mail.python.org/mailman/listinfo/python-list

use regex to search the page one time to get two types of Information

2016-08-19 Thread iMath
I need to use regex to search two types of Information within a web page, while it seems searching the page two times rather than one is much time consuming , is it possible to search the page one time to get two or more types of Information? -- https://mail.python.org/mailman/listinfo/python

[issue27378] remove ref to Phil Schwartz's 'Kodos' in regex HOWTO

2016-06-23 Thread Berker Peksag
Berker Peksag added the comment: Thanks! -- nosy: +berker.peksag resolution: -> fixed stage: -> resolved status: open -> closed versions: -Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker

[issue27378] remove ref to Phil Schwartz's 'Kodos' in regex HOWTO

2016-06-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset 23182404a85c by Berker Peksag in branch '3.5': Issue #27378: Remove an outdated reference from regex HOWTO https://hg.python.org/cpython/rev/23182404a85c New changeset 21cb299a9626 by Berker Peksag in branch 'default': Issue #27378: Merge from 3.5

[issue27378] remove ref to Phil Schwartz's 'Kodos' in regex HOWTO

2016-06-23 Thread Matt Morrison
PyQt4 - Qt3 is one of its requirements. I didn't bother running 2to3 on it. I propose we delete the last sentence of the above paragraph altogether. There are many good regex sites out there, including regex101, regexr, Debuggex, regexpal, and more (those are just the first few in my bookmark

[issue13592] repr(regex) doesn't include actual regex

2016-06-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This looks weird, but is not a bug. See issue26090. After implementing that feature truncating a pattern would look more explicit. -- ___ Python tracker

[issue13592] repr(regex) doesn't include actual regex

2016-06-20 Thread Adam Bartoš
Adam Bartoš added the comment: Isn't the trucation of long patterns too rough? Currently, repr(re.compile("a" * 1000)) returns something like "re.compile('a)", i.e. no ending quote and no indication that something was truncated (besides the missing quote). It looked like a bug to

Re: python regex: variable length of positive lookbehind assertion

2016-06-16 Thread Marko Rauhamaa
Jussi Piitulainen <jussi.piitulai...@helsinki.fi>: > Michael Torrie writes: > >> On 06/15/2016 08:57 AM, Jussi Piitulainen wrote: >>> Marko Rauhamaa writes: >>>> And nothing in alister's answer suggests that. >>> >>> Now *I'm* surpr

Re: python regex: variable length of positive lookbehind assertion

2016-06-15 Thread Jussi Piitulainen
Michael Torrie writes: > On 06/15/2016 08:57 AM, Jussi Piitulainen wrote: >> Marko Rauhamaa writes: >>> And nothing in alister's answer suggests that. >> >> Now *I'm* surprised. > > He simply said, here's a regex that can parse the example string the OP >

Re: python regex: variable length of positive lookbehind assertion

2016-06-15 Thread Michael Torrie
On 06/15/2016 08:57 AM, Jussi Piitulainen wrote: > Marko Rauhamaa writes: >> And nothing in alister's answer suggests that. > > Now *I'm* surprised. He simply said, here's a regex that can parse the example string the OP gave us (which maybe looked a bit like HTML, but li

Re: python regex: variable length of positive lookbehind assertion

2016-06-15 Thread Jussi Piitulainen
alister writes: > On Wed, 15 Jun 2016 15:55:42 +0300, Jussi Piitulainen wrote: > >> alister writes: >> >>> On Tue, 14 Jun 2016 20:28:24 -0700, Yubin Ruan wrote: >>> >>>> Hi everyone, >>>> I am struggling writing a right

Re: python regex: variable length of positive lookbehind assertion

2016-06-15 Thread alister
On Wed, 15 Jun 2016 15:55:42 +0300, Jussi Piitulainen wrote: > alister writes: > >> On Tue, 14 Jun 2016 20:28:24 -0700, Yubin Ruan wrote: >> >>> Hi everyone, >>> I am struggling writing a right regex that match what I want: >>> >>

Re: python regex: variable length of positive lookbehind assertion

2016-06-15 Thread Jussi Piitulainen
d aaa bbb false_tail \ >>>> true_head some_text_here ccc ddd eee >>>> true_tail" >>>> >>>> I want to match the all the text surrounded by those " ", >>>> [...] >>> >>> don't try to use regex

Re: python regex: variable length of positive lookbehind assertion

2016-06-15 Thread Marko Rauhamaa
true_head some_text_here ccc ddd eee >>> true_tail" >>> >>> I want to match the all the text surrounded by those " ", >>> [...] >> >> don't try to use regex to parse html it wont work reliably >> [...] > &g

Re: python regex: variable length of positive lookbehind assertion

2016-06-15 Thread Jussi Piitulainen
alister writes: > On Tue, 14 Jun 2016 20:28:24 -0700, Yubin Ruan wrote: > >> Hi everyone, >> I am struggling writing a right regex that match what I want: >> >> Problem Description: >> >> Given a string like this: >> >> >>>stri

Re: python regex: variable length of positive lookbehind assertion

2016-06-15 Thread alister
On Tue, 14 Jun 2016 20:28:24 -0700, Yubin Ruan wrote: > Hi everyone, > I am struggling writing a right regex that match what I want: > > Problem Description: > > Given a string like this: > > >>>string = "false_head aaa bbb false_tail \ >

Re: python regex: variable length of positive lookbehind assertion

2016-06-15 Thread Lawrence D’Oliveiro
On Wednesday, June 15, 2016 at 3:28:37 PM UTC+12, Yubin Ruan wrote: > I want to match the all the text surrounded by those " ", You are trying to use regex (type 3 grammar) to parse HTML (type 2 grammar) <https://en.wikipedia.org/wiki/Formal_grammar#The_Chomsky_hierarchy>

Re: python regex: variable length of positive lookbehind assertion

2016-06-15 Thread Vlastimil Brom
2016-06-15 5:28 GMT+02:00 Yubin Ruan <ablacktsh...@gmail.com>: > Hi everyone, > I am struggling writing a right regex that match what I want: > > Problem Description: > > Given a string like this: > > >>>string = "false_head aaa bbb false_tail \ >

Re: python regex: variable length of positive lookbehind assertion

2016-06-14 Thread Jussi Piitulainen
Yubin Ruan writes: > Hi everyone, > I am struggling writing a right regex that match what I want: > > Problem Description: > > Given a string like this: > > >>>string = "false_head aaa bbb false_tail \ > true_head some_text_here ccc

Re: python regex: variable length of positive lookbehind assertion

2016-06-14 Thread Yubin Ruan
On Wednesday, June 15, 2016 at 12:18:31 PM UTC+8, Lawrence D’Oliveiro wrote: > On Wednesday, June 15, 2016 at 3:28:37 PM UTC+12, Yubin Ruan wrote: > > > I want to match the all the text surrounded by those " ", > > You are trying to use regex (type 3 grammar) t

python regex: variable length of positive lookbehind assertion

2016-06-14 Thread Yubin Ruan
Hi everyone, I am struggling writing a right regex that match what I want: Problem Description: Given a string like this: >>>string = "false_head aaa bbb false_tail \ true_head some_text_here ccc ddd eee true_tail" I want to match the all the text

[issue26336] Expose regex bytecode as attribute of compiled pattern object

2016-06-05 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: Yes, you can get at it with ctypes. I released a small (and virtually untested) library at https://github.com/JelleZijlstra/regdis that provides dis-like capabilities. -- ___ Python tracker

[issue26336] Expose regex bytecode as attribute of compiled pattern object

2016-06-05 Thread Terry J. Reedy
via ctypes? Is so, I think an re disassembler with docs would be a good pypi module. Maybe you could also make it work with Barnett's regex module. -- nosy: +terry.reedy ___ Python tracker <rep...@bugs.python.org> <http://bugs.py

[issue26336] Expose regex bytecode as attribute of compiled pattern object

2016-06-05 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: Updated patch attached. I don't feel strongly about whether this should be in Python, but it seems potentially useful at least as a tool to learn more about how re is implemented. If I have time I may write a tool using __pattern_code__ and the sre_constants

[issue26336] Expose regex bytecode as attribute of compiled pattern object

2016-06-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Added comments on Rietveld. I still not think this is a good idea. -- ___ Python tracker ___

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