special-characters

Matching special characters and letters in regex

主宰稳场 提交于 2019-11-28 06:18:05
I am trying to validate a string, that should contain letters numbers and special characters &-._ only. For that I tried with a regular expression. var pattern = /[a-zA-Z0-9&_\.-]/ var qry = 'abc&*'; if(qry.match(pattern)) { alert('valid'); } else{ alert('invalid'); } While using the above code, the string abc&* is valid. But my requirement is to show this invalid. ie Whenever a character other than a letter, a number or special characters &-._ comes, the string should evaluate as invalid. How can I do that with a regex? Add them to the allowed characters, but you'll need to escape some of

php str_split() every n characters with accents

爷,独闯天下 提交于 2019-11-28 05:51:17
问题 I've this code to split a string every 3 characters, works fine, but accents are messed: $splitted_array = str_split('waderòrò',3); but it outputs print_r($splitted_array ); >> Array ( [0] => wad [1] => er▯ [2] => ▯r▯ [3] => ▯ ) I know similar question was already asked, but this question didn't help me. ucwords and french accented lettres encoding. I did try mb_split, but without success, because I wasn't able to find the right regex... What would be the right code? 回答1: User "veszelovszki

Android default charset when sending http post/put - Problems with special characters

最后都变了- 提交于 2019-11-28 05:27:22
I have configured the apache httpClient like so: HttpProtocolParams.setContentCharset(httpParameters, "UTF-8"); HttpProtocolParams.setHttpElementCharset(httpParameters, "UTF-8"); I also include the http header "Content-Type: application/json; charset=UTF-8" for all http post and put requests. I am trying to send http post/put requests with a json body that contains special characters (ie. chinese characters via the Google Pinyin keyboard, symbols, etc.) The characters appear as gibberish in the logs but I think this is because DDMS does not support UTF-8, as descibed in this issue. The problem

How to use special characters in choice command - Batch File

送分小仙女□ 提交于 2019-11-28 05:25:50
问题 I would like to add special characters like < | into my choice command, how can I do that? Here's my old code: CHOICE /C ABCDEFGHIJKLMNOPQRSTUVWXYZ0134567928 /N /M "Press 8 ...." and I would like it to be something like : CHOICE /C `~,.<>?ABCDEFGHIJKLMNOPQRSTUVWXYZ0134567928 /N /M "Press 8 ...." Any help will be appreciated, thanks. EDIT: Since some of you may ask why do I need so many choice, I'm here to answer. It is because pressing an invalid choice would give you an annoying beep that I

How to use the %.% operator in R (EDIT: operator deprecated in 2014)

拈花ヽ惹草 提交于 2019-11-28 04:35:13
EDIT: %.% operator is now deprecated. Use %>% from magrittr. ORIGINAL QUESTION What does this %.% operator do?? I've seen it used a lot with the dplyr package, but can't seem to find any supporting documentation on what it is or how it works. It seems to chain commands together, but that's as far as I can tell...While I'm at it, can anyone explain what the gambit of those special operators that hang around with the % sign do and when is technically the right time to use them to code better? Carlos Cinelli I think Hadley would be the best person to explain to you, but I will give it a shot. %.%

Special characters in CSS selectors [closed]

≯℡__Kan透↙ 提交于 2019-11-28 04:05:29
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . What are those? So I can escape them.. 回答1: In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, or a hyphen

Problem with PHP and Mysql UTF-8 (Special Character)

安稳与你 提交于 2019-11-28 03:13:20
问题 I Have a form with one textbox called(ProductTitle) if I write as example "Étuit" in the textbox and click on Save, I post the data in a table called Product. The result int the database for ProductTitle is Étuit. My concern is about the Special character. Instead of putting É in the database , I got that É When I Load the Product Title ("Étuit") from the database into a span. That show correctly. BUT When I load it inside a Textbox to Edit the Product Title, that show Étuit. Anybody know

Java replaceAll() regex does not work [duplicate]

一笑奈何 提交于 2019-11-28 02:18:51
This question already has an answer here: String replace method is not replacing characters 5 answers I'm trying to replace all special characters with a "%", like: "123.456/789" -> "123%465%798" my regular expression is: [^a-zA-Z0-9]+ In online tools* it works perfecly, but in java s.replaceAll("[^a-zA-Z0-9]+", "%"); strings remain untouched. *I tried: http://www.regexplanet.com/ http://regex101.com/ and others Strings are immutable. You forgot to reassign new String to the s variable :) s = s.replaceAll("[^a-zA-Z0-9]+", "%"); // ^ this creates a new String replaceAll() like all methods in

Python to show special characters

岁酱吖の 提交于 2019-11-28 01:35:52
问题 I know there are tons of threads regarding this issue but I have not managed to find one which solves my problem. I am trying to print a string but when printed it doesn't show special characters (e.g. æ, ø, å, ö and ü). When I print the string using repr() this is what I get: u'Von D\xc3\xbc' and u'\xc3\x96berg' Does anyone know how I can convert this to Von Dü and Öberg ? It's important to me that these characters are not ignored, e.g. myStr.encode("ascii", "ignore") . EDIT This is the code

How to use jq when the variable has a period

走远了吗. 提交于 2019-11-28 01:02:14
I'm trying to get the following to work & it's not, help me please: curl -s 'https://cryptofresh.com/api/asset/markets?asset=MKR' | jq .OPEN.BTC The variable in question includes a period, I tried just about everything to escape the period && also tried surrounding it in quotes; no go ; this is the variable I'm looking to pull from (I ran jq without any filters, and truncated the output here to show what I need. Thanks in advance future problem solver! curl -s 'https://cryptofresh.com/api/asset/markets?asset=MKR' | jq .... "OPEN.BTC": { "volume24": 0.932166, "price": 0.09995, "updated": "2016