i'll take a stab at clarifying.<div>there was some discussion on irc about being able to represent regexpes using less escaping.</div><div>it was suggested that we could have something similar to perl, ruby, javascript and other languages for specifying a regexp pattern, something like #rx/pattern/</div>
<div>so for example you could type</div><div>(regexp-replace* #rx/\bregex\b/ text "regexp")</div><div>instead of</div><div><div>(regexp-replace* #px"\\bregex\\b" text "regexp")</div></div><div>
<br></div><div>it turns out there are some patterns that need to be added to racket before we could do something like that. creating a pattern that matches a newline involves writing a pattern that has a newline in it, rather than a pattern with a backslash followed by an 'n'.</div>
<div><br></div><div>(regexp-match? #rx"\n" "\n") => #t</div><div>(regexp-match? #px"\n" "\n") => #t</div><div>(regexp-match? #rx"\\n" "\n") => #f</div><div>
(regexp-match? #rx"\\n" "n") => #t</div><div>(regexp-match? #px"\\n" "\n") => raises "read: bad pregexp string: illegal alphabetic escape</div><div><br></div><div>pauan went through and found all such missing escapes and reported them.</div>
<div><br></div><div><div class="gmail_quote">On Mon, Nov 28, 2011 at 00:48, David T. Pierson <span dir="ltr"><<a href="mailto:dtp@mindstory.com">dtp@mindstory.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Sat, Nov 26, 2011 at 10:35:57PM -0800, Pauan wrote:<br>
> It was brought up that my explanation was confusing, and I agree it is.<br>
> So I'll try again. The following should return #t:<br>
</div>...<br>
> (regexp-match? "\\n" "\n")<br>
<br>
I am confused about a number of things in your emails, so for simplicity<br>
I'm focusing on the above expression only.<br>
<br>
Your email subject mentions pregexp, but your pattern is a string<br>
literal, which AFAICT will be compiled into a regular expression using<br>
regexp not pregexp. Therefore it isn't clear whether you are suggesting<br>
a change to regexp syntax or pregexp syntax.<br>
<br>
Currently, #rx"\\n" matches like #rx"n" and #px"\\n" is an error:<br>
<br>
> (regexp-match? #rx"\\n" "n")<br>
#t<br>
> #px"\\n"<br>
readline-input::569: read: bad pregexp string: illegal alphabetic escape<br>
<br>
Both of these behaviors agree with the syntax documented at<br>
<br>
<a href="http://docs.racket-lang.org/reference/regexp.html?q=regexp-match%3F#(part._regexp-syntax)" target="_blank">http://docs.racket-lang.org/reference/regexp.html?q=regexp-match%3F#(part._regexp-syntax)</a><br>
<br>
To add to my confusion, your original email mentioned #px"\\\\n", which<br>
currently matches a backslash followed by an 'n'.<br>
<br>
Perhaps you are suggesting that #px"\\n" should mean the same as<br>
#px"\n" rather than being an error? I don't see a need for this but<br>
perhaps you have a rationale in mind?<br>
<span class="HOEnZb"><font color="#888888"><br>
David<br>
</font></span><div class="HOEnZb"><div class="h5">_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://lists.racket-lang.org/listinfo/dev" target="_blank">http://lists.racket-lang.org/listinfo/dev</a><br>
</div></div></blockquote></div><br></div>