Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34707
| Path | csiph.com!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | Arne Vajhøj <arne@vajhoej.dk> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: String replaceAll escaping sequence |
| Date | Sat, 25 Jun 2016 22:14:07 -0400 |
| Organization | Aioe.org NNTP Server |
| Lines | 32 |
| Message-ID | <nkndpe$mmq$1@gioia.aioe.org> (permalink) |
| References | <aea37416-d56a-4ff7-a2f8-202cd96e3266@googlegroups.com> <5283fa41-28ac-46ce-8199-1538d2a55fa7@googlegroups.com> |
| NNTP-Posting-Host | 7SK6yTFfqwlIPNBLl3l7Qg.user.gioia.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| Xref | csiph.com comp.lang.java.programmer:34707 |
Show key headers only | View raw
On 6/25/2016 8:57 PM, Lew wrote: > On Friday, June 24, 2016 at 4:35:14 PM UTC-7, Philipp Kraus wrote: >> Hello, >> >> I try to add an escape sequence to a String. I have got String with >> #, _ & (symbols which must be escaped on LaTeX) and try to put a >> backslash in front of the symbol, so: >> >> # -> \# $ -> \$ >> >> I try to do this with: >> >> mystring.replaceAll( "([\\$\\#&%_])", "\\\\$1" ) >> >> but in this case i get a double backslash \\$ for example, on >> >> mystring.replaceAll( "([\\$\\#&%_])", "\\$1" ) >> >> I don't get any backslash at the output. >> >> How can I create the correct regex to put one backslash in front of >> the symbol? > > Maybe you shouldn't put backslash in your search string (twice). It is not necessary, but it does no harm either. Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
String replaceAll escaping sequence Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2016-06-24 00:31 -0700
Re: String replaceAll escaping sequence Arne Vajhøj <arne@vajhoej.dk> - 2016-06-24 19:49 -0400
Re: String replaceAll escaping sequence Lew <lewbloch@gmail.com> - 2016-06-25 17:57 -0700
Re: String replaceAll escaping sequence Arne Vajhøj <arne@vajhoej.dk> - 2016-06-25 22:14 -0400
Re: String replaceAll escaping sequence Daniel Pitts <usenet@coloraura.com> - 2016-06-27 13:52 -0700
csiph-web