I want to split a string based on a non-regular expression. My input is a plain string. So, for example, given the input "hello.*there"
and ".*"
, I want the result ("hello" "there").
Doing this obv doesn't work:
(regexp-split (regexp sep) str))
since it will try to match the regular expression .*
. How do I escape sep
to nullify any rege开发者_高级运维xp-like patterns?
regexp-quote
Claudiu, many of the questions you have asked about PLT-Scheme are answered in the documentation. Not to say it's wrong to ask questions, sometimes you'll get a more in-depth answer here.
There are many documents in the set of documentation that comes with PLT-Scheme. There are 2 pieces of documentation you want to be familiar with:
- The PLT Scheme Guide. http://docs.plt-scheme.org/guide/index.html
- The PLT Scheme Reference: http://docs.plt-scheme.org/reference/index.html
Both are installed locally when you install PLT-Scheme (formerly called DrScheme).
The Guide is intended for those new to Scheme or PLT-Scheme. The Reference is more in depth.
Eli pointed to the link in the Reference documentation. The regexp-quote function is also mentioned is the much shorter and more readable Guide, here http://docs.plt-scheme.org/guide/regexp-intro.html along with mention of quoting special characters using \, as well as a link to the Reference documentation.
精彩评论