` option.
`lgrep -f` uses pattern as just a fixed text, not regexp.
2018年3月21日(水) 20:35 Rhodri James :
> On 21/03/18 10:44, sankarram...@gmail.com wrote:
> > Hi,
> >
> > I have a requirement.
> >
> > cmd="cat |grep -c 'if [ -t 1 ]; then mesg n 2>/dev/null;
On 21/03/18 10:44, sankarram...@gmail.com wrote:
Hi,
I have a requirement.
cmd="cat |grep -c 'if [ -t 1 ]; then mesg n 2>/dev/null; fi'"
I need to escape only the square brackets in above variable since its not
grepping without escaping the brackets.
You need to escape the square brackets a
On Wed, Mar 21, 2018 at 9:44 PM, wrote:
> Hi,
>
> I have a requirement.
>
> cmd="cat |grep -c 'if [ -t 1 ]; then mesg n 2>/dev/null; fi'"
>
> I need to escape only the square brackets in above variable since its not
> grepping without escaping the brackets.
>
> Please help.
You're putting this
Hi,
You don't need a regexp for this, the "replace" method on a string
will do what you want:
>>> s = 'this is a [string'
>>> print(s.replace('[', '\\['))
this is a \[string
Paul
On 21 March 2018 at 10:44, wrote:
> Hi,
>
&g
Hi,
I have a requirement.
cmd="cat |grep -c 'if [ -t 1 ]; then mesg n 2>/dev/null; fi'"
I need to escape only the square brackets in above variable since its not
grepping without escaping the brackets.
Please help.
Thanks.
--
https://mail.python.org/mailman/listinfo/python-list
> (?s)struct (.+?)\s*\{\s*(.+?)\s*\};
Thank you Vlastimil Brom for regexp and for explanation!
--
https://mail.python.org/mailman/listinfo/python-list
szykc...@gmail.com writes:
> Please help me with this regexp or tell me that I neeed do this in other way.
I think that using regexps to parse those structures is fragile and difficult
to get right[0], as there are lots of corner cases (comments, complex types,
...).
I'd suggest usin
W dniu wtorek, 26 grudnia 2017 21:53:14 UTC+1 użytkownik Lawrence D’Oliveiro
napisał:
> On Wednesday, December 27, 2017 at 2:15:21 AM UTC+13, szyk...@gmail.com wrote:
> > struct (.+)\s*{\s*(.+)\s*};
>
> You realize that “.” matches anything? Whereas I think you want to match
> non-whitespace in
On Tue, 26 Dec 2017 05:14:55 -0800 (PST), szykc...@gmail.com wrote:
[snip]
> So: I develop regexp which to my mind should work, but it doesn't and
> I don't know why. The broken regexp is like this:
> struct (.+)\s*{\s*(.+)\s*};
[snip]
You'll probably get better help f
r bellow my struct definition and makes inappropriate further regexp
> filtering (against variables).
>
> So: I develop regexp which to my mind should work, but it doesn't and I
> don't know why. The broken regexp is like this:
> struct (.+)\s*{\s*(.+)\s*};
> As you can see it
t name and 2) struct definition. Struct
definition I need because some inline functions can appear bellow my struct
definition and makes inappropriate further regexp filtering (against variables).
So: I develop regexp which to my mind should work, but it doesn't and I don't
know why.
I have a script that was running perfectly for some time. It uses:
array = [elem for elem in output if 'CPU_TEMP' in elem]
But because output has changed, I have to check for CPU_TEMP at the beginning
of the line. What would be the best way to implement this?
--
Cecil Westerhof
Senior Softwar
Rick Johnson writes:
>> There is now also a line that starts with: PCH_CPU_TEMP:
>> And I do not want that one.
>
> Yes. But be aware, that while the `str.startswith(target)`
> method is indeed more efficient than a more generalized
> "inclusion test", if the target is not _always_ at the
> begin
On Monday, December 4, 2017 at 9:44:27 AM UTC, Cecil Westerhof wrote:
> I have a script that was running perfectly for some time. It uses:
> array = [elem for elem in output if 'CPU_TEMP' in elem]
>
> But because output has changed, I have to check for CPU_TEMP at the
> beginning of the line. W
Neil Cerutti writes:
> On 2017-12-04, Cecil Westerhof wrote:
>> Joel Goldstick writes:
>>
>>> On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder
>>> wrote:
>>>
On 12/4/17 4:36 AM, Cecil Westerhof wrote:
> I have a script that was running perfectly for some time. It uses:
> a
On 2017-12-04, Cecil Westerhof wrote:
> Joel Goldstick writes:
>
>> On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder
>> wrote:
>>
>>> On 12/4/17 4:36 AM, Cecil Westerhof wrote:
>>>
I have a script that was running perfectly for some time. It uses:
array = [elem for elem in output if
On 12/4/2017 11:14 AM, Ned Batchelder wrote:
> On 12/4/17 9:13 AM, Rick Johnson wrote:
>> Perhaps it's not politically correct for me to say this, but
>> i've never been one who cared much about political
>> correctness, so i'm just going to say it...
>
> Cecil, feel free to ignore the rest of Rick
On 12/4/17 9:13 AM, Rick Johnson wrote:
> Perhaps it's not politically correct for me to say this, but
> i've never been one who cared much about political
> correctness, so i'm just going to say it...
Cecil, feel free to ignore the rest of Rick's message.â His messages are
famous for their outra
On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder wrote:
> On 12/4/17 4:36 AM, Cecil Westerhof wrote:
>
>> I have a script that was running perfectly for some time. It uses:
>> array = [elem for elem in output if 'CPU_TEMP' in elem]
>>
>> But because output has changed, I have to check for CPU_
cts, i don't think it's too much to ask of a
~~Senior~~ Software Engineer that they possess the basic skills required to
peruse the Python documentation and decide which method is most appropriate for
the situation at hand. And if you're using Python on a regular basis, then you
shou
Joel Goldstick writes:
> On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder
> wrote:
>
>> On 12/4/17 4:36 AM, Cecil Westerhof wrote:
>>
>>> I have a script that was running perfectly for some time. It uses:
>>> array = [elem for elem in output if 'CPU_TEMP' in elem]
>>>
>>> But because output h
On 12/4/17 4:36 AM, Cecil Westerhof wrote:
> I have a script that was running perfectly for some time. It uses:
> array = [elem for elem in output if 'CPU_TEMP' in elem]
>
> But because output has changed, I have to check for CPU_TEMP at the
> beginning of the line. What would be the best way
Ned Batchelder writes:
> On 12/4/17 4:36 AM, Cecil Westerhof wrote:
>> I have a script that was running perfectly for some time. It uses:
>> array = [elem for elem in output if 'CPU_TEMP' in elem]
>>
>> But because output has changed, I have to check for CPU_TEMP at the
>> beginning of the l
Neil Cerutti writes:
> On 2017-12-04, Cecil Westerhof wrote:
>> Joel Goldstick writes:
>>
>>> On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder
>>> wrote:
>>>
On 12/4/17 4:36 AM, Cecil Westerhof wrote:
> I have a script that was running perfectly for some time. It uses:
> a
Rick Johnson writes:
>> There is now also a line that starts with: PCH_CPU_TEMP:
>> And I do not want that one.
>
> Yes. But be aware, that while the `str.startswith(target)`
> method is indeed more efficient than a more generalized
> "inclusion test", if the target is not _always_ at the
> begin
On 2017-12-04, Cecil Westerhof wrote:
> Joel Goldstick writes:
>
>> On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder
>> wrote:
>>
>>> On 12/4/17 4:36 AM, Cecil Westerhof wrote:
>>>
I have a script that was running perfectly for some time. It uses:
array = [elem for elem in output if
On 12/4/2017 11:14 AM, Ned Batchelder wrote:
On 12/4/17 9:13 AM, Rick Johnson wrote:
Perhaps it's not politically correct for me to say this, but
i've never been one who cared much about political
correctness, so i'm just going to say it...
Cecil, feel free to ignore the rest of Rick's message
On 12/4/17 9:13 AM, Rick Johnson wrote:
Perhaps it's not politically correct for me to say this, but
i've never been one who cared much about political
correctness, so i'm just going to say it...
Cecil, feel free to ignore the rest of Rick's message. His messages are
famous for their outrageo
on in your projects, i don't
think it's too much to ask of a ~~Senior~~ Software Engineer
that they possess the basic skills required to peruse the
Python documentation and decide which method is most
appropriate for the situation at hand. And if you're using
Python on a regular basis, th
Joel Goldstick writes:
> On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder
> wrote:
>
>> On 12/4/17 4:36 AM, Cecil Westerhof wrote:
>>
>>> I have a script that was running perfectly for some time. It uses:
>>> array = [elem for elem in output if 'CPU_TEMP' in elem]
>>>
>>> But because output h
Ned Batchelder writes:
> On 12/4/17 4:36 AM, Cecil Westerhof wrote:
>> I have a script that was running perfectly for some time. It uses:
>> array = [elem for elem in output if 'CPU_TEMP' in elem]
>>
>> But because output has changed, I have to check for CPU_TEMP at the
>> beginning of the l
On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder
wrote:
> On 12/4/17 4:36 AM, Cecil Westerhof wrote:
>
>> I have a script that was running perfectly for some time. It uses:
>> array = [elem for elem in output if 'CPU_TEMP' in elem]
>>
>> But because output has changed, I have to check for CPU_
On 12/4/17 4:36 AM, Cecil Westerhof wrote:
I have a script that was running perfectly for some time. It uses:
array = [elem for elem in output if 'CPU_TEMP' in elem]
But because output has changed, I have to check for CPU_TEMP at the
beginning of the line. What would be the best way to impl
On Monday, December 4, 2017 at 9:44:27 AM UTC, Cecil Westerhof wrote:
> I have a script that was running perfectly for some time. It uses:
> array = [elem for elem in output if 'CPU_TEMP' in elem]
>
> But because output has changed, I have to check for CPU_TEMP at the
> beginning of the line.
I have a script that was running perfectly for some time. It uses:
array = [elem for elem in output if 'CPU_TEMP' in elem]
But because output has changed, I have to check for CPU_TEMP at the
beginning of the line. What would be the best way to implement this?
--
Cecil Westerhof
Senior Softwa
ast,
>>>>>> and I wouldn't want to rely on there not being any now.
>>>>>
>>>>>
>>>>> The ones I've seen still require some input length (I'm thinking
>>>>> exponential rematch backoff stuff here). I suspect
;>>
>>>> The ones I've seen still require some input length (I'm thinking
>>>> exponential rematch backoff stuff here). I suspect that if your test
>>>> query matches the RE against a fixed empty string it is hard to be
>>>> exploited.
; exponential
>>> rematch backoff stuff here). I suspect that if your test query matches
>>> the RE
>>> against a fixed empty string it is hard to be exploited. i.e. I think
>>> most of
>>> this stuff isn't expensive in terms of compiling the rege
;> test query matches the RE against a fixed empty string it is hard
>>> to be exploited. i.e. I think most of this stuff isn't expensive
>>> in terms of compiling the regexp but in executing it against text.
>>
>>Well yes, but presumably if the OP is receiv
y now.
The ones I've seen still require some input length (I'm thinking exponential
rematch backoff stuff here). I suspect that if your test query matches the RE
against a fixed empty string it is hard to be exploited. i.e. I think most of
this stuff isn't expensive in terms of comp
On Wed, Aug 9, 2017 at 6:13 AM, Peter Heitzer
wrote:
> Larry Martell wrote:
>>On Tue, Aug 8, 2017 at 12:51 PM, Chris Angelico wrote:
>>> On Wed, Aug 9, 2017 at 2:37 AM, Larry Martell
>>> wrote:
>>>> Anyone have any code or know of any packages for valid
On Tuesday, August 8, 2017 at 11:38:34 AM UTC-5, larry@gmail.com wrote:
> Anyone have any code or know of any packages for validating a regexp?
>
> I have an app that allows users to enter regexps for db searching.
> When a user enters an invalid one (e.g. 'A|B|'
On 2017-08-09, Cameron Simpson wrote:
> On 08Aug2017 17:31, Jon Ribbens wrote:
>>On 2017-08-08, Chris Angelico wrote:
>>> On Wed, Aug 9, 2017 at 2:57 AM, Larry Martell
>>> wrote:
>>>> Yeah, it does not throw for 'A|B|' - but mysql chokes on
Larry Martell wrote:
>On Tue, Aug 8, 2017 at 12:51 PM, Chris Angelico wrote:
>> On Wed, Aug 9, 2017 at 2:37 AM, Larry Martell
>> wrote:
>>> Anyone have any code or know of any packages for validating a regexp?
>>>
>>> I have an app that allows users t
On 08Aug2017 17:31, Jon Ribbens wrote:
On 2017-08-08, Chris Angelico wrote:
On Wed, Aug 9, 2017 at 2:57 AM, Larry Martell wrote:
Yeah, it does not throw for 'A|B|' - but mysql chokes on it with empty
subexpression for regexp' I'd like to flag it before it gets to
On 2017-08-08, Chris Angelico wrote:
> On Wed, Aug 9, 2017 at 2:57 AM, Larry Martell wrote:
>> Yeah, it does not throw for 'A|B|' - but mysql chokes on it with empty
>> subexpression for regexp' I'd like to flag it before it gets to SQL.
>
> Okay, so y
On Wed, Aug 9, 2017 at 2:57 AM, Larry Martell wrote:
> On Tue, Aug 8, 2017 at 12:51 PM, Chris Angelico wrote:
>> On Wed, Aug 9, 2017 at 2:37 AM, Larry Martell
>> wrote:
>>> Anyone have any code or know of any packages for validating a regexp?
>>>
>>>
On Tue, Aug 8, 2017 at 12:57 PM, Larry Martell wrote:
> On Tue, Aug 8, 2017 at 12:51 PM, Chris Angelico wrote:
>> On Wed, Aug 9, 2017 at 2:37 AM, Larry Martell
>> wrote:
>>> Anyone have any code or know of any packages for validating a regexp?
>>>
>>>
On Wed, Aug 9, 2017 at 2:37 AM, Larry Martell wrote:
> Anyone have any code or know of any packages for validating a regexp?
>
> I have an app that allows users to enter regexps for db searching.
> When a user enters an invalid one (e.g. 'A|B|' is one I just saw) it
>
On Tue, Aug 8, 2017 at 12:51 PM, Chris Angelico wrote:
> On Wed, Aug 9, 2017 at 2:37 AM, Larry Martell wrote:
>> Anyone have any code or know of any packages for validating a regexp?
>>
>> I have an app that allows users to enter regexps for db searching.
>> When a
> I have an app that allows users to enter regexps for db searching.
> When a user enters an invalid one (e.g. 'A|B|' is one I just saw) it
> causes downstream issues. I'd like to flag it at entry time.
Just call re.compile(...) on it and catch any exceptions, modulo
caveats about operating with u
On 2017-08-08 17:37, Larry Martell wrote:
Anyone have any code or know of any packages for validating a regexp?
I have an app that allows users to enter regexps for db searching.
When a user enters an invalid one (e.g. 'A|B|' is one I just saw) it
causes downstream issues. I'd
Anyone have any code or know of any packages for validating a regexp?
I have an app that allows users to enter regexps for db searching.
When a user enters an invalid one (e.g. 'A|B|' is one I just saw) it
causes downstream issues. I'd like to flag it at entry time.
--
https://
Serhiy Storchaka writes:
> Seems the documentation is not accurate. Could you file a report on
> https://bugs.python.org/ ?
Thank you everybody answered!
Here it is: http://bugs.python.org/issue28450
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanu
Serhiy Storchaka wrote:
> On 14.10.16 20:01, Peter Otten wrote:
> def double_bs(s): return "".join(s.split("\\"))
>> ...
> Just use s.replace('\\', r'\\').
D'oh!
--
https://mail.python.org/mailman/listinfo/python-list
On 14.10.16 19:15, Chris Angelico wrote:
I wasn't specifically aware that the re module was doing the same
thing, but it'll be from the same purpose and goal. The idea is that,
for instance, Windows path names in non-raw string literals will no
longer behave differently based on whether the path
On 14.10.16 20:01, Peter Otten wrote:
Lele Gaifax wrote:
So, how am I supposed to achieve the mentioned intent? By doubling the
escape in the replacement?
If there are no escape sequences aimed to be handled by re.sub() you can
escape the replacement wholesale:
re.sub(r'\s+', re.escape(r'\s+
On 14.10.16 18:40, Lele Gaifax wrote:
Hi all,
trying out pgcli with Python 3.6.0b2 I got an error related to what seem a
different behaviour, or even a bug, of re.sub().
The original intent is to replace spaces within a string with the regular
expression
\s+ (see
https://github.com/dbcli/pgcl
On Sat, Oct 15, 2016 at 4:48 AM, Ned Batchelder wrote:
> On Friday, October 14, 2016 at 1:27:09 PM UTC-4, Chris Angelico wrote:
>> On Sat, Oct 15, 2016 at 4:12 AM, Ned Batchelder
>> wrote:
>> > There doesn't seem to be a change to string literals at all. It's only a
>> > change in the regex engi
On Friday, October 14, 2016 at 1:27:09 PM UTC-4, Chris Angelico wrote:
> On Sat, Oct 15, 2016 at 4:12 AM, Ned Batchelder
> wrote:
> > There doesn't seem to be a change to string literals at all. It's only a
> > change in the regex engine.
> >
> > Python 3.6.0b2 (default, Oct 10 2016, 21:30:05
Ned Batchelder writes:
> On Friday, October 14, 2016 at 12:50:44 PM UTC-4, Lele Gaifax wrote:
>> Chris Angelico writes:
>>
>> > There's a shift as of 3.6 to make unrecognized alphabetic escapes into
>> > errors, or at least warnings.
>>
>> But we are talking about raw strings here, specificall
On Sat, Oct 15, 2016 at 4:12 AM, Ned Batchelder wrote:
> There doesn't seem to be a change to string literals at all. It's only a
> change in the regex engine.
>
> Python 3.6.0b2 (default, Oct 10 2016, 21:30:05)
> [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
> Typ
On Friday, October 14, 2016 at 1:00:12 PM UTC-4, Chris Angelico wrote:
> On Sat, Oct 15, 2016 at 3:45 AM, Lele Gaifax wrote:
> > Chris Angelico writes:
> >
> >> There's a shift as of 3.6 to make unrecognized alphabetic escapes into
> >> errors, or at least warnings.
> >
> > But we are talking abo
On Friday, October 14, 2016 at 12:50:44 PM UTC-4, Lele Gaifax wrote:
> Chris Angelico writes:
>
> > There's a shift as of 3.6 to make unrecognized alphabetic escapes into
> > errors, or at least warnings.
>
> But we are talking about raw strings here, specifically r'\s+'.
>
> I agree that with
Lele Gaifax wrote:
> Peter Otten <__pete...@web.de> writes:
>
>> Lele Gaifax wrote:
>>
>>> The original intent is to replace spaces within a string with the
>>> regular expression \s+ (see
>>> ...
>>> Accordingly to the documentation
>>> (https://docs.python.org/3.6/library/re.html#re.sub) “unkno
On Sat, Oct 15, 2016 at 3:45 AM, Lele Gaifax wrote:
> Chris Angelico writes:
>
>> There's a shift as of 3.6 to make unrecognized alphabetic escapes into
>> errors, or at least warnings.
>
> But we are talking about raw strings here, specifically r'\s+'.
>
> I agree that with plain strings it's a
Lele Gaifax writes:
> And the documentation as well, to clarify the fact immediately, without
> assuming one will scroll down to the "changed in version" part (at least, that
> is what seem the rule in other parts of the manual).
Also, I'd prefer the "Changed in 3.6" be less ambiguous whether it
Chris Angelico writes:
> There's a shift as of 3.6 to make unrecognized alphabetic escapes into
> errors, or at least warnings.
But we are talking about raw strings here, specifically r'\s+'.
I agree that with plain strings it's a plus.
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di q
Peter Otten <__pete...@web.de> writes:
> Lele Gaifax wrote:
>
>> The original intent is to replace spaces within a string with the regular
>> expression \s+ (see
>> ...
>> Accordingly to the documentation
>> (https://docs.python.org/3.6/library/re.html#re.sub) “unknown escapes [in
>> the repl argu
Lele Gaifax wrote:
> Hi all,
>
> trying out pgcli with Python 3.6.0b2 I got an error related to what seem a
> different behaviour, or even a bug, of re.sub().
>
> The original intent is to replace spaces within a string with the regular
> expression \s+ (see
>
https://github.com/dbcli/pgcli/blo
On Sat, Oct 15, 2016 at 2:40 AM, Lele Gaifax wrote:
> Accordingly to the documentation
> (https://docs.python.org/3.6/library/re.html#re.sub)
> “unknown escapes [in the repl argument] such as \& are left alone”.
>
> Am I missing something, or is this a regression?
Further down, you'll find this
Hi all,
trying out pgcli with Python 3.6.0b2 I got an error related to what seem a
different behaviour, or even a bug, of re.sub().
The original intent is to replace spaces within a string with the regular
expression
\s+ (see
https://github.com/dbcli/pgcli/blob/master/pgcli/packages/prioritizat
On 2016-02-11 03:09, Larry Martell wrote:
On Wed, Feb 10, 2016 at 10:00 PM, MRAB wrote:
On 2016-02-11 02:48, Larry Martell wrote:
Given this string:
s = """|Type=Foo
... |Side=Left"""
print s
|Type=Foo
|Side=Left
I can match with this:
m = re.search(r'^\|Type=(.*)$\n^\|Side=(.*)$',
On Wed, Feb 10, 2016 at 10:00 PM, MRAB wrote:
> On 2016-02-11 02:48, Larry Martell wrote:
>>
>> Given this string:
>>
> s = """|Type=Foo
>>
>> ... |Side=Left"""
>
> print s
>>
>> |Type=Foo
>> |Side=Left
>>
>> I can match with this:
>>
> m = re.search(r'^\|Type=(.*)$\n^\|Side=(.*)$'
On 2016-02-11 02:48, Larry Martell wrote:
Given this string:
s = """|Type=Foo
... |Side=Left"""
print s
|Type=Foo
|Side=Left
I can match with this:
m = re.search(r'^\|Type=(.*)$\n^\|Side=(.*)$',s,re.MULTILINE)
print m.group(0)
|Type=Foo
|Side=Left
print m.group(1)
Foo
print m.group(2)
Given this string:
>>> s = """|Type=Foo
... |Side=Left"""
>>> print s
|Type=Foo
|Side=Left
I can match with this:
>>> m = re.search(r'^\|Type=(.*)$\n^\|Side=(.*)$',s,re.MULTILINE)
>>> print m.group(0)
|Type=Foo
|Side=Left
>>> print m.group(1)
Foo
>>> print m.group(2)
Left
But when I try and sub
On Fri, 04 Jul 2014 14:27:12 +0200, Florian Lindner wrote:
> self.regexps = [r"it (?P\d+) .* dt complete yes |
> write-iteration-checkpoint |",
> r"it (?P\d+) read ahead"
My first thought is what is the effect of '|' as the last character in
the regex?
--
Denis McMahon, denismf
")
for regexp in cre:
match = regexp.match(block)
for grp in regexp.groupindex:
data = match.group(grp) if match else None
self.data[grp].append(data)
block is a list of strings, terminated by \n. self.regexps:
self.r
Hello,
I have that piece of code:
def _split_block(self, block):
cre = [re.compile(r, flags = re.MULTILINE) for r in self.regexps]
block = "".join(block)
print(block)
print("---")
for regexp in cre:
On Thursday, October 31, 2013 12:56:49 AM UTC+8, rusi wrote:
> Well it seems that we are considerably closer to a solution to the GG
> double-spaced crap problem.
>
>
>
> Just wondering if someone can suggest a cleanup of the regexp part
>
>
>
> Currently I
Well it seems that we are considerably closer to a solution to the GG
double-spaced crap problem.
Just wondering if someone can suggest a cleanup of the regexp part
Currently I have (elisp)
(defun clean-gg ()
(interactive)
1 (replace-regexp "^> *\n> *\n> *$" "-=\
ture the single preceding character. E.g. in sed:
>>>
>>>sed -e 's/\(.\)$hello\$/\1XXX/'
>>>
>>> but some RE engines (Perl's, for example) allow you specify zero-width
>>> assertions. You could, in Perl, write
>>>
>
without having to capture whatever preceded the target string. But
since Perl also has negative zero-width look-behind you can code your
request even more directly:
s/(?
I dont wanna be tied to a specific language etc so I just want a
regexp and as many versions as possible. Maybe I should try
Rivka Miller writes:
> Thanks everyone, esp this gentleman.
Kind of you to single me out, but it was Janis Papanagnou who first
posted the solution that you say "works best" for you.
--
Ben.
--
http://mail.python.org/mailman/listinfo/python-list
Rivka Miller wrote:
> I am looking for a regexp for a string not at the beginning of the
> line.
>
> For example, I want to find $hello$ that does not occur at the
> beginning of the string, ie all $hello$ that exclude ^$hello$.
The begging of the string is zero width character. S
Am 26.10.2012 06:45, schrieb Rivka Miller:
Thanks everyone, esp this gentleman.
Who is "this"?
The solution that worked best for me is just to use a DOT before the
string as the one at the beginning of the line did not have any char
before it.
Which was what I suggested, and where you rude
On Thu, Oct 25, 2012 at 10:00 PM, Ed Morton wrote:
> Because there is no solution - there IS no _RE_ that will match a string not
> at the beginning of a line.
Depending on what the OP meant, the following would both work:
- r"^(?!mystring)" (the string does not occur at the beginning)
- r"(?!^)
some RE engines (Perl's, for example) allow you specify zero-width
> assertions. You could, in Perl, write
>
> s/(?<=.)\$hello\$/XXX/
>
> without having to capture whatever preceded the target string. But
> since Perl also has negative zero-width look-behind you can code your
&g
On Thu, 25 Oct 2012 18:08:53 -0700 (PDT), Rivka Miller
wrote in
<73f60cf3-d932-4366-a405-676748856...@q16g2000yqc.googlegroups.com>:
>no one has really helped yet.
We regret that you are not a satisfied customer.
Please take your receipt to the cashier and you will receive double your
money bac
> I want to search and modify.
>
> I dont wanna be tied to a specific language etc so I just want a
> regexp and as many versions as possible.
If you just find the one command line app that will perform the task,
like awk, then the other languages you will just need to call the
commandline
On 25/10/2012 21:53, Rivka Miller wrote:
Hello Programmers,
I am looking for a regexp for a string not at the beginning of the
line.
Why bother with a silly regex thingy when simple string methods will
suffice e.g.
'yourstring'.find('xyz', 1)
or
'yourstring
pture whatever preceded the target string. But
since Perl also has negative zero-width look-behind you can code your
request even more directly:
s/(? I dont wanna be tied to a specific language etc so I just want a
> regexp and as many versions as possible. Maybe I should try in emacs
> and so
to a specific language etc so I just want a
regexp and as many versions as possible. Maybe I should try in emacs
and so I am now posting to emacs groups also, although javascript has
rich set of regexp facilities.
examples
$hello$ should not be selected but
not hello but all of the $hello$ and $
f producing the same output, but that's
not the question you're asking.
Ed.
I want to search and modify.
I dont wanna be tied to a specific language etc so I just want a
regexp and as many versions as possible. Maybe I should try in emacs
and so I am now posting to emacs groups also
On 10/25/2012 09:08 PM, Rivka Miller wrote:
> On Oct 25, 2:27 pm, Danny wrote:
>> Why you just don't give us the string/input, say a line or two, and what you
>> want off of it, so we can tell better what to suggest
> no one has really helped yet.
>
>
>
> first non beginning of the line and I wi
just want a
regexp and as many versions as possible. Maybe I should try in emacs
and so I am now posting to emacs groups also, although javascript has
rich set of regexp facilities.
examples
$hello$ should not be selected but
not hello but all of the $hello$ and $hello$ ... $hello$ each o
:
On 25 October 2012 16:53, Rivka Miller wrote:
> I am looking for a regexp for a string not at the beginning of the
> line.
There are probably quite a few ways to do this, but '(?>> pattern = re.compile(r"(?>> re.findall(pattern, "this is some text")
[
On 25.10.2012 22:53, Rivka Miller wrote:
> Hello Programmers,
>
> I am looking for a regexp for a string not at the beginning of the
> line.
>
> For example, I want to find $hello$ that does not occur at the
> beginning of the string, ie all $hello$ that exclude ^$hello$
Hello Programmers,
I am looking for a regexp for a string not at the beginning of the
line.
For example, I want to find $hello$ that does not occur at the
beginning of the string, ie all $hello$ that exclude ^$hello$.
In addition, if you have a more difficult problem along the same
lines, I
On Thu, Sep 13, 2012 at 5:30 AM, Neal Becker wrote:
> I noticed this and thought it looked interesting:
>
> http://search.cpan.org/~dconway/Regexp-
> Grammars-1.021/lib/Regexp/Grammars.pm#DESCRIPTION
>
> I'm wondering if python has something equivalent?
The pyparsing modu
1 - 100 of 573 matches
Mail list logo