MalteseUnderdog wrote:
Hi there I just started python (but this question isn't that trivial
since I couldn't find it in google :) )
I have the following text file entries (simplified)
start #frag 1 start
x=Dog # frag 1 end
stop
start# frag 2 start
x=Cat # frag 2 end
stop
start #fra
On Oct 29, 7:01 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > I need a regex expression which returns the start to the x=ANIMAL for
> > only the x=Dog fragments so all my entries should be start ...
> > (something here) ... x=Dog . So I am really interested in fragments 1
> > and 3 only.
>
> > My i
I need a regex expression which returns the start to the x=ANIMAL for
only the x=Dog fragments so all my entries should be start ...
(something here) ... x=Dog . So I am really interested in fragments 1
and 3 only.
My idea (primitive) ^start.*?x=Dog doesn't work because clearly it
would return r
Hi there I just started python (but this question isn't that trivial
since I couldn't find it in google :) )
I have the following text file entries (simplified)
start #frag 1 start
x=Dog # frag 1 end
stop
start# frag 2 start
x=Cat # frag 2 end
stop
start #frag 3 start
x=Dog #frag 3
#x27;t fit in the parser-engine I had
and I was close to making a release.
But still: thanks!
--Tim
--
View this message in context:
http://www.nabble.com/Python-regex-question-tp17773487p18997385.html
Sent from the Python - python-list mailing list archive at Nabble.com.
--
http://mail.python.org/mailman/listinfo/python-list
Tim van der Leeuw wrote:
Hi,
I'm trying to create a regular expression for matching some particular
XML strings. I want to extract the contents of a particular XML tag,
only if it follows one tag, but not follows another tag. Complicating
this, is that there can be any number of other tags in
Hi,
I'm trying to create a regular expression for matching some particular XML
strings. I want to extract the contents of a particular XML tag, only if it
follows one tag, but not follows another tag. Complicating this, is that
there can be any number of other tags in between.
So basically, my re
En Sun, 09 Dec 2007 16:45:53 -0300, charonzen <[EMAIL PROTECTED]>
escribió:
>> [John Machin] Another suggestion is to ensure that the job
>> specification is not
>> overly simplified. How did you parse the text into "words" in the
>> prior exercise that produced the list of bigrams? Won't you
> Another suggestion is to ensure that the job specification is not
> overly simplified. How did you parse the text into "words" in the
> prior exercise that produced the list of bigrams? Won't you need to
> use the same parsing method in the current exercise of tagging the
> bigrams with an under
On Dec 9, 6:13 pm, charonzen <[EMAIL PROTECTED]> wrote:
The following *may* come close to doing what your revised spec
requires:
import re
def ch_replace2(alist, text):
for bigram in alist:
pattern = r'\b' + bigram.replace('_', ' ') + r'\b'
text = re.sub(pattern, bigram, text)
On Dec 9, 6:13 pm, charonzen <[EMAIL PROTECTED]> wrote:
> I have a list of strings. These strings are previously selected
> bigrams with underscores between them ('and_the', 'nothing_given', and
> so on). I need to write a regex that will read another text string
> that this list was derived from
I have a list of strings. These strings are previously selected
bigrams with underscores between them ('and_the', 'nothing_given', and
so on). I need to write a regex that will read another text string
that this list was derived from and replace selections in this text
string with those from my l
> re.search(expr, string) compiles and searches every time. This can
> potentially be more expensive in calculating power. especially if you
> have to use the expression a lot of times.
The re module-level helper functions cache expressions and their
compiled form in a dict. They are only compiled
crybaby wrote:
> On Sep 20, 4:12 pm, Tobiah <[EMAIL PROTECTED]> wrote:
>> [EMAIL PROTECTED] wrote:
>>> I need to extract the number on each >> i.e 49.950 from the following:
>>> 49.950
>>> The actual number between: 49.950 can be any number of
>>> digits before decimal and after decimal.
>>> #
On Sep 20, 4:12 pm, Tobiah <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > I need to extract the number on each
> > i.e 49.950 from the following:
>
> > 49.950
>
> > The actual number between: 49.950 can be any number of
> > digits before decimal and after decimal.
>
> > ##.
[EMAIL PROTECTED] wrote:
>I need to extract the number on each
>i.e 49.950 from the following:
>
> 49.950
>
>The actual number between: 49.950 can be any number of
>digits before decimal and after decimal.
>
> ##.
>
>How can I just extract the real/integer number using regex?
>
>
>
[EMAIL PROTECTED] wrote:
> I need to extract the number on each
> i.e 49.950 from the following:
>
> 49.950
>
> The actual number between: 49.950 can be any number of
> digits before decimal and after decimal.
>
> ##.
>
> How can I just extract the real/integer number using rege
I need to extract the number on each 49.950
The actual number between: 49.950 can be any number of
digits before decimal and after decimal.
##.
How can I just extract the real/integer number using regex?
--
http://mail.python.org/mailman/listinfo/python-list
johnny <[EMAIL PROTECTED]> wrote:
> I need to get the content inside the bracket.
> eg. some characters before bracket (3.12345).
> I need to get whatever inside the (), in this case 3.12345.
> How do you do this with python regular expression?
I'm going to presume that you mean something like:
On Fri, 11 May 2007 08:54:31 -0700, johnny wrote:
> I need to get the content inside the bracket.
>
> eg. some characters before bracket (3.12345).
>
> I need to get whatever inside the (), in this case 3.12345.
>
> How do you do this with python regular expression?
Why would you bother? If yo
On May 12, 2:21 am, Gary Herron <[EMAIL PROTECTED]> wrote:
> johnny wrote:
> > I need to get the content inside the bracket.
>
> > eg. some characters before bracket (3.12345).
>
> > I need to get whatever inside the (), in this case 3.12345.
>
> > How do you do this with python regular expression?
johnny wrote:
> I need to get the content inside the bracket.
>
> eg. some characters before bracket (3.12345).
>
> I need to get whatever inside the (), in this case 3.12345.
>
> How do you do this with python regular expression?
>
>>> import re
>>> x = re.search("[0-9.]+", "(3.12345)")
>>> pr
I need to get the content inside the bracket.
eg. some characters before bracket (3.12345).
I need to get whatever inside the (), in this case 3.12345.
How do you do this with python regular expression?
--
http://mail.python.org/mailman/listinfo/python-list
23 matches
Mail list logo