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
Hey Gerhard,
Gerhard Häring wrote:
>
> 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
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
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
> 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
14 matches
Mail list logo