alphanumeric

Regular expression in Java that takes as input alphanumeric followed by forward slash and then again alphanumeric

痞子三分冷 提交于 2019-12-13 02:06:10
问题 I need a regular expression that takes as input alphanumeric followed by forward slash and then again alphanumeric. How do I write regular expression in Java for this? Example for this is as follows: adc9/fer4 I tried by using regular expression as follows: String s = abc9/ferg5; String pattern="^[a-zA-Z0-9_]+/[a-zA-z0-9_]*$"; if(s.matches(pattern)) { return true; } But the problem it is accepting all the strings of form abc9/ without checking after forward slash. 回答1: Reference: http:/

Using alphanumeric mode to encode URL in QR-code?

若如初见. 提交于 2019-12-12 16:19:49
问题 I need to build a QR-code for my url as small as possible - it is short enough to use shorteners (and I don't want to be dependent to their reliability). HTTP: // SUBDOM.DOMAIN.EU 8-bit byte mode is too place-wasting, I can reach Version 2 there, but Version 1 in alphanumeric mode . Is there a way how to set alphanumeric mode to use only lower-case letters instead of upper-case? May using upper-case in URL cause problem in any browser / platform? (I tested it in Firefox, IE but I am afraid,

Naturally sort a list of alpha-numeric tuples by the tuple's first element in Python

a 夏天 提交于 2019-12-12 12:23:40
问题 A previous stackoverflow question explains how to sort a list of strings alpha-numerically. I would like to sort a list of tuples alphanumerically by the tuple's first element. Example 1: >>> sort_naturally_tuple([('b', 0), ('0', 1), ('a', 2)]) [('0', 1), ('a', 2), ('b', 0)] Example 2: >>> sort_naturally_tuple([('b10', 0), ('0', 1), ('b9', 2)]) [('0', 1), ('b9', 2), ('b10', 0)] Update: To emphasize the alphanumeric factor, please review example 2. 回答1: Using the second answer from the other

How do I check if a string only contains alphanumeric characters and dashes?

风格不统一 提交于 2019-12-12 09:29:03
问题 The string I'm testing can be matched with [\w-]+ . Can I test if a string conforms to this in Python, instead of having a list of the disallowed characters and testing for that? 回答1: If you want to test a string against a regular expression, use the re library import re valid = re.match('^[\w-]+$', str) is not None 回答2: Python has regex as well: import re if re.match('^[\w-]+$', s): ... Or you could create a list of allowed characters: from string import ascii_letters if all(c in ascii

How to recognise and extract alpha numeric characters in R

风流意气都作罢 提交于 2019-12-11 11:27:35
问题 I want to extract alphanumeric characters from a partiular sentence in R. I have tried the following: aa=grep("[:alnum:]","abc") .This should return integer(0) ,but it returns 1,which should not be the case as "abc" is not an alphanumeric. What am I missing here? Essentially I am looking for a function,that only searches for characters that are combinations of both alphabets and numbers,example:"ABC-0112","PCS12SCH" Thanks in advance for your help. 回答1: [[:alnum:]] matches alphabets or digits

Sort alphanumeric strings in numpy matrix

☆樱花仙子☆ 提交于 2019-12-11 08:56:37
问题 I have a matrix with 10 columns of different types. I sorted them based on the alphanumeric column with : data = np.sort(data, axis=0,order='AlphaNumColumn') It didn't do the job right, i.e. BFT_job10_q0 BFT_job13_q0 BFT_job13_q1 BFT_job1_q0 instead of : BFT_job1_q0 BFT_job10_q0 BFT_job13_q0 BFT_job13_q1 Anything numpy could do about it?? Thanks! 回答1: The sorting order seems to be right. I would recommend you to review your numbering: 1 becomes 01 If you have to keep your numbering, you can

Split numeric part from alphanumeric string using C#

旧巷老猫 提交于 2019-12-11 07:51:11
问题 I have alphanumeric string list. For example: 1A 2B 7K 10A I want to get only the numeric part and then compare them, if it is less than 10 I need not to add it in another list. What I want to know the regex to split the numeric part from the string. Any help. What I have done till now is: if (x == y) // also handles null return 0; if (x == null) return -1; if (y == null) return +1; int ix = 0; int iy = 0; while (ix < x.Length && iy < y.Length) { if (Char.IsDigit(x[ix]) && Char.IsDigit(y[iy])

auto increment alphanumeric characters php

穿精又带淫゛_ 提交于 2019-12-11 05:57:58
问题 Is is possible to auto increment an alphanumeric number with php so it looks like: AB001 AB002 ... ... BA001 ... ... ZZ001 This code will then need to be added to mysql, I was thinking a varchar(5). Cheers, 回答1: Try it and see $x = 'AA998'; for($i = 0; $i < 10; $i++) { echo $x++,'<br />'; } EDIT Reverse of letters and digits $x = '000AY'; for($i = 0; $i < 10; $i++) { echo $x++,'<br />'; } or reversal after ZZ999 $x = 'ZZ998'; for($i = 0; $i < 10; $i++) { $x++; if (strlen($x) > 5) $x = '000AA'

Alphanumeric increment algorithm in JAVA [closed]

半世苍凉 提交于 2019-12-10 12:37:52
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I need to implement alphanumeric increment algorithm like AAA001 should become AAA002 AAA999 should become AAB000 and so on. All alphabets are in uppercase and letters are from 0-9. It can contain alphabet or letter at any position in the alphanumeric string. There are some rules

T-Sql - Order By on Alphanumeric

社会主义新天地 提交于 2019-12-10 11:05:52
问题 i have a list of alphanumeric tokens, say '1a', '1b', '02', '03', '10', '11', etc... Now, what's the best way to do an order by on this list of tokens? I am getting '1a', '1b', '10', '11', '02', '03', but i need it to be '1a', '1b', '02', '03', '10', '11' UPDATE ok, i am doing this after the suggestion but it's not working. declare @tokens table(token varchar(20)); insert into @tokens select '1a' select '1b' select '02' select '10' select * from @tokens order by case when ISNUMERIC(token) = 1