Thanks all for your suggestions on this. The 'splitter' idea was
particularly good, not something I'd thought of. Sorry for my late
reply.
--
http://mail.python.org/mailman/listinfo/python-list
John Pye wrote:
> Is there an easy and general way that I can split these perl-style
> find-and-replace expressions into something I can use with Python, eg
> re.sub('search','replace',str) ?
Another candidate:
>>> re.compile(r"(?:/((?:\\.|[^/])*))").findall(r"/abc\\/def\/ghi//jkl")
['abc',
James Stroud wrote:
> Yes, this would be a case of the expression (left side) ending with a
> "\" as I mentioned above.
Sorry for not tracking the context.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Peter Otten wrote:
> James Stroud wrote:
>
>> James Stroud wrote:
>>> John Pye wrote:
Hi all
I have a file with a bunch of perl regular expressions like so:
/(^|[\s\(])\*([^ ].*?[^ ])\*([\s\)\.\,\:\;\!\?]|$)/$1'''$2'''$3/ #
bold
/(^|[\s\(])\_\_([^ ].*?[^ ])\_\_([
James Stroud wrote:
> James Stroud wrote:
>> John Pye wrote:
>>> Hi all
>>>
>>> I have a file with a bunch of perl regular expressions like so:
>>>
>>> /(^|[\s\(])\*([^ ].*?[^ ])\*([\s\)\.\,\:\;\!\?]|$)/$1'''$2'''$3/ #
>>> bold
>>> /(^|[\s\(])\_\_([^ ].*?[^ ])\_\_([\s\)\.\,\:\;\!\?]|$)/$1''$2<\/
>
James Stroud wrote:
> John Pye wrote:
>> Hi all
>>
>> I have a file with a bunch of perl regular expressions like so:
>>
>> /(^|[\s\(])\*([^ ].*?[^ ])\*([\s\)\.\,\:\;\!\?]|$)/$1'''$2'''$3/ #
>> bold
>> /(^|[\s\(])\_\_([^ ].*?[^ ])\_\_([\s\)\.\,\:\;\!\?]|$)/$1''$2<\/
>> b>''$3/ # italic bold
>> /(^|
John Pye wrote:
> I have a file with a bunch of perl regular expressions like so:
>
> /(^|[\s\(])\*([^ ].*?[^ ])\*([\s\)\.\,\:\;\!\?]|$)/$1'''$2'''$3/ #
> bold
> /(^|[\s\(])\_\_([^ ].*?[^ ])\_\_([\s\)\.\,\:\;\!\?]|$)/$1''$2<\/
> b>''$3/ # italic bold
> /(^|[\s\(])\_([^ ].*?[^ ])\_([\s\)\.\,\:\;\!
John Pye wrote:
> Hi all
>
> I have a file with a bunch of perl regular expressions like so:
>
> /(^|[\s\(])\*([^ ].*?[^ ])\*([\s\)\.\,\:\;\!\?]|$)/$1'''$2'''$3/ #
> bold
> /(^|[\s\(])\_\_([^ ].*?[^ ])\_\_([\s\)\.\,\:\;\!\?]|$)/$1''$2<\/
> b>''$3/ # italic bold
> /(^|[\s\(])\_([^ ].*?[^ ])\_([\s\
Hi all
I have a file with a bunch of perl regular expressions like so:
/(^|[\s\(])\*([^ ].*?[^ ])\*([\s\)\.\,\:\;\!\?]|$)/$1'''$2'''$3/ #
bold
/(^|[\s\(])\_\_([^ ].*?[^ ])\_\_([\s\)\.\,\:\;\!\?]|$)/$1''$2<\/
b>''$3/ # italic bold
/(^|[\s\(])\_([^ ].*?[^ ])\_([\s\)\.\,\:\;\!\?]|$)/$1''$2''$3/ #
it