I need to replace all '%' characters in string with "%25" but I don't want to replace % in %25 to avoid situation, when I get something like this %%25. I want to do it in Java. Example: input: % sdfsdaf %25 expected result: %25 sdfsdaf %25  Do you know what should I use to get it?
262
I don't really understand regular expressions.  Can you explain them to me in an easy-to-follow manner?  If there are any online tools or books, could you also link to them?
13909
When encoding a query string to be sent to a web server - when do you use escape() and when do you use encodeURI() or encodeURIComponent():  Use escape:  escape("% +&amp;=");   OR  use encodeURI() / encodeURIComponent()  encodeURI("http://www.google.com?var1=value1&amp;var2=value2");  encodeURIComponent("var1=value1&amp;var2=value2");
112817
Before I go and create a custom tag or Java method to do it, what is the standard way to escape HTML characters in JSP?  I have a String object and I want to display it in the HTML so that it appears to the user as is.  For example:  String a = "Hello &lt; World";   Would become:  Hello &amp;lt; World
16238
How do I escape a backtick ` within a code block?  This is probably a duplicate, since I'm sure it's a common concern, but I can't find a question that addresses this specifically.  How do I write List'1 with the "1" character still in the code-text format?
32835
Here is what I tried doing:  #!/bin/sh res=`df | awk 'FNR == 2 { print $5 }'` res2=$((res+0))   Here is my error:     -bash: 53%: syntax error: operand expected (error token is "%")   I Googled 'string to int bash' which showed me $((res+0)) but it doesn't work due to the % in the string (53%). How do I convert it in such a way I can do an if statement such as the one below (but that works)?  if [ "$res2" -ge 50 ] then     echo "Your disk &gt;=50% full!" fi
50533
I need to perform Diffs between Java strings. I would like to be able to rebuild a string using the original string and diff versions. Has anyone done this in Java? What library do you use?  String a1; // This can be a long text String a2; // ej. above text with spelling corrections String a3; // ej. above text with spelling corrections and an additional sentence  Diff diff = new Diff(); String differences_a1_a2 = Diff.getDifferences(a,changed_a); String differences_a2_a3 = Diff.getDifferences(a,changed_a);     String[] diffs = new String[]{a,differences_a1_a2,differences_a2_a3}; String new_a3 = Diff.build(diffs); a3.equals(new_a3); // this is true
6461
I would like to create a String.replaceAll() method in JavaScript and I'm thinking that using a regex would be most terse way to do it.  However, I can't figure out how to pass a variable in to a regex.  I can do this already which will replace all the instances of "B" with "A".  "ABABAB".replace(/B/g, "A");   But I want to do something like this:  String.prototype.replaceAll = function(replaceThis, withThis) {     this.replace(/replaceThis/g, withThis); };   But obviously this will only replace the text "replaceThis"...so how do I pass this variable in to my regex string?
60593
I'm trying to write a query which replaces the special characters with space. Below code helps to identify the rows. (alpha-numeric characters, comma and space is valid):  SELECT columnA FROM tableA WHERE columnA like '%[^a-Z0-9, ]%'   How can I integrate the replace function into the select statement so that all characters other than alphanumeric, comma and space in the result set are  replaced by ' ' (space). This one won't work:  SELECT replace(columnA,'%[^a-Z0-9, ]%',' ') FROM tableA WHERE columnA like '%[^a-Z0-9, ]%'
66745
I'm using the Message module on Drupal 7.  For Replacement tokens, the help text says:     A comma-separated list of replacement tokens, e.g. %title or !url, of   which the message text makes use of. Each replacement token has to   start with one of the special characters "@", "%" or "!". This   character controls the sanitization method used, analogously to the   t() function.   What's the difference between %, !, and @?  Are there standards about when I should use each symbol?
90874
To print part of the string, replace , with . I use command:  echo "${q:16:6}" | sed 's/,/./'   Is it possible to use something like:  echo "${q:16:6/,/.}"   because it does not work?
16095
Is there a good way to remove HTML from a Java string? A simple regex like replaceAll(&quot;\\&lt;.*?&gt;&quot;, &quot;&quot;)   will work, but things like &amp;amp; wont be converted correctly and non-HTML between the two angle brackets will be removed (i.e. the .*? in the regex will disappear).
5405
If I pass PHP variables with . in their names via $_GET PHP auto-replaces them with _ characters. For example:  &lt;?php echo "url is ".$_SERVER['REQUEST_URI']."&lt;p&gt;"; echo "x.y is ".$_GET['x.y'].".&lt;p&gt;"; echo "x_y is ".$_GET['x_y'].".&lt;p&gt;";   ... outputs the following:  url is /SpShipTool/php/testGetUrl.php?x.y=a.b x.y is . x_y is a.b.   ... my question is this: is there any way I can get this to stop? Cannot for the life of me figure out what I've done to deserve this  PHP version I'm running with is 5.2.4-2ubuntu5.3.
46012
I am trying to find all matches in a string that begins with | |.    I have tried: if ($line =~ m/^\\\|\s\\\|/) which didn't work.   Any ideas?
9861
How can I use Unicode-aware regular expressions in JavaScript?  For example, there should be something akin to \w that can match any code-point in Letters or Marks category (not just the ASCII ones), and hopefully have filters like [[P*]] for punctuation, etc.
2826
I see that the code in many packages and examples contains percent signs % at the end of (many) lines. What are they used for? Do they affect the parsing of those lines?
45470
I'm trying to make a URL with a tilde character (~) in it:  \usepackage{url} ... \url{http://lyle.smu.edu/~tspell/jaws}   It looks right in the resulting PDF, but when clicking on it the browser goes to a wrong URL: http://lyle.smu.edu/%18tspell/jaws  If I type in the browser %7e (escape code for '~') instead of %18 the browser then goes to the correct URL.  Any idea how to get a correct link in the PDF?
4307
How can I replace multiple spaces in a string with only one space in C#?  Example:  1 2 3  4    5   would be:  1 2 3 4 5