Remove special characters from a string in JSTL - jstl

I have a string in jstl: 'Tall &. Big'
But I want this to replace with :'TallBig'.
I am trying to this by using fn:replace(String,'&',''); but I don't know how to mention multiple characters in this function to be removed.
Means I want to remove all special characters from a string.

Related

How do you print the underscore in a zebra label?

I’m printing a parameter returned from a query that’s a string of letters and underscores.
The label prints just the letters without the underscores, and I’m not sure how to fix it.
^FD<String>^FS
^FH^FD<String>^FS
Thank you very much.
(Removing the FH Only reads to the first underscore.
The ^FH command without parameter defaults to underscore as the hexidecimal escape character. Either remove the ^FH or specify a different escape character like backslash using ^FH\^FD<String>^FS.

Need to match a string containing the string file: and report in the string

Need to match a string containing the string "file://\\" and "report" in the string.
if i use the regular expression (file://\\\\)(.*)\\\\report\\\\(.*) it is working fine.
but, if i use the expression (file://\\\\)(.*)\\report\\(.*) it is giving errors.
My question is why do need to use four back slashes(\\\\) to do a match for one back slash present before and after the report string.
*wstring target(L"file://\\\\Example\\report\\001");
wsmatch wideMatch;
wregex wrx(L"(file://\\\\)(.*)\\\\report\\\\(.*)");
if (regex_match(target.cbegin(), target.cend(), wideMatch, wrx))
wcout << L"The matching text is:" << wideMatch.str() << endl;*
can some one please answer. Thanks in advance...
Backslashes are special in both string literals and in regular expressions. To match a backslash in a regular expression you need to escape it, by adding a second backslash. And to have two backslashes in a string literal then you need to escape both of them leading to you needing four backslashes.

Regex that considers apostrophes as word characters? [duplicate]

So I want to split a string in java on any non-alphanumeric characters.
Currently I have been doing it like this
words= Str.split("\\W+");
However I want to keep apostrophes("'") in there. Is there any regular expression to preserve apostrophes but kick the rest of the junk? Thanks.
words = Str.split("[^\\w']+");
Just add it to the character class. \W is equivalent to [^\w], which you can then add ' to.
Do note, however, that \w also actually includes underscores. If you want to split on underscores as well, you should be using [^a-zA-Z0-9'] instead.
For basic English characters, use
words = Str.split("[^a-zA-Z0-9']+");
If you want to include English words with special characters (such as fiancé) or for languages that use non-English characters, go with
words = Str.split("[^\\p{L}0-9']+");

string has trailing whitespaces that aren't white spaces? (i.e. strip doesn't get rid of it)

I have the following string I got from parsing some html:
"this is my string  "
If I use .strip or .rstrip the string remains the same.
However if I literally type the string "this is my string " and type .strip then the trailing spaces get stripped.
This leads me to believe the string I obtained from parsing html is not containing trailing white spaces. So the question I have is, 1) what is trailing the string if it isn't a white space? and 2) how do I get rid of it?
The unicode table contains several whitespace characters, and it is possible that all of these characters are not handle by the strip methods. If you want to use a regular expression with the sub method, you can try this simple pattern: /\p{Space}+\z/ or /[[:space:]]+\z/ to trim all the blank characters on the right. (obviously, the replacement string must be empty)
Note: the \s is equivalent to [ \t\r\n\f] in Ruby and doesn't contain all whitespaces of the unicode table.

WinPhone7 pass values with special character between pages

I am going to pass string value between pages.
The value contains "&" character.
Since the values are split using "&", so the value is chopped.
How can I escape this special character?
use URL encoding...
for ex: if you want '&' .. use '& amp;' (no spaces)
Recommended way is to use
Uri.EscapeUriString(stringToEscape)
method which does this for you.
Documentation at
http://msdn.microsoft.com/en-us/library/system.uri.escapeuristring%28v=VS.95%29.aspx

Resources