[IPython-dev] Curly braces stripped from magic input
Greg Wilson
gvwilson at third-bit.com
Sat Aug 31 14:35:24 EDT 2013
On 2013-08-31 2:21 PM, Thomas Kluyver wrote:
> On 31 August 2013 10:07, Matt Davis <jiffyclub at gmail.com
> <mailto:jiffyclub at gmail.com>> wrote:
>
> Is there any way around this, or do we just have to tell our
> students to use \d{{3,4}} instead of valid regex?
>
>
> No, I don't think we currently have any way to disable this. You may
> prefer to declare regexes in regular Python code rather than within
> IPython magic commands.
Hi Thomas,
The point of this tool is to allow us to teach regular expressions
*without* having to embed them in Python (or anything else) --- we've
found they're easier for newcomers to digest if they can wrap their
heads around \d+\s+\d+\b first, and then worry about raw strings,
re.whatever, match objects, and so on. What we have now lets us do this:
%%regex a+b
xyz
aaabxx
xabbbx
xyzab
xabxabx
which is about as simple as it can get. We can tell them to double the
{}'s if we have to, but it seems weird not to have access to the
original (unchomped) string...
Thanks,
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130831/14f64946/attachment.html>
More information about the IPython-dev
mailing list