On 1/18/2016 14:05, Charles T. Smith wrote:
On Fri, 15 Jan 2016 14:20:17 +0100, Wolfgang Maier wrote:
pattern = pattern_str.compile()
try:
matches = pattern.findall(some_str, endpos=some_str.index(tail))
except ValueError:
# do something if tail is not found
pass
Oh! I thin
On Fri, 15 Jan 2016 14:20:17 +0100, Wolfgang Maier wrote:
> pattern = pattern_str.compile()
> try:
> matches = pattern.findall(some_str, endpos=some_str.index(tail))
> except ValueError:
> # do something if tail is not found
> pass
Oh! I think that's it!
matches = findall (patte
On 01/15/2016 04:24 AM, Charles T. Smith wrote:
while ($str != $tail) {
$str ~= s/^(head-pattern)//;
use ($1);
}
IDK... maybe the OP is looking for something like this? :
import re
def do_something(matchobj):
print("I found {}".format(matchobj.group(0)))
return ""
tail =
On 2016-01-15, Ulli Horlacher wrote:
> Charles T. Smith wrote:
>> while ($str != $tail) {
>> $str ~= s/^(head-pattern)//;
>> use ($1);
>> }
>
> use() is illegal syntax in Perl.
Actually it is not. OP is defnitely thinking of `use` as a placeholder for
some general use of the value $1.
I
Charles T. Smith wrote:
> while ($str != $tail) {
> $str ~= s/^(head-pattern)//;
> use ($1);
> }
use() is illegal syntax in Perl.
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de
Universitaet Stuttgart
Charles T. Smith wrote:
> What the original snippet does is parse *and consume* a string - actually,
> to avoid maintaining a cursor traverse the string. The perl feature is
> that substitute allows the found pattern to be replaced, but retains the
> group after the expression is complete.
That
On 15.01.2016 12:04, Charles T. Smith wrote:
On Fri, 15 Jan 2016 11:42:24 +0100, Wolfgang Maier wrote:
On 15.01.2016 10:43, Peter Otten wrote:
Charles T. Smith wrote:
while ($str != $tail) {
$str ~= s/^(head-pattern)//;
use ($1);
}
things = []
while some_str != tail:
On Fri, 15 Jan 2016 11:42:24 +0100, Wolfgang Maier wrote:
> On 15.01.2016 10:43, Peter Otten wrote:
>> Charles T. Smith wrote:
>>
>>> while ($str != $tail) {
>>> $str ~= s/^(head-pattern)//;
>>> use ($1);
>>> }
>>
>
> things = []
> while some_str != tail:
> m = re.match(patter
On Fri, 15 Jan 2016 11:04:32 +, Charles T. Smith wrote:
> capability, somehow, but that was apparently overlooked. For example,
> by storing string state in the match object and having a *sub* method without
> a string parameter.
--
https://mail.python.org/mailman/listinfo/python-list
On 15.01.2016 10:43, Peter Otten wrote:
Charles T. Smith wrote:
while ($str != $tail) {
$str ~= s/^(head-pattern)//;
use ($1);
}
For those whose Perl's a little rusty: what does this do?
A self-contained example might also be useful...
Right, an explanation would certainly get yo
Charles T. Smith wrote:
> while ($str != $tail) {
> $str ~= s/^(head-pattern)//;
> use ($1);
> }
For those whose Perl's a little rusty: what does this do?
A self-contained example might also be useful...
--
https://mail.python.org/mailman/listinfo/python-list
while ($str != $tail) {
$str ~= s/^(head-pattern)//;
use ($1);
}
--
https://mail.python.org/mailman/listinfo/python-list
12 matches
Mail list logo