alphanumeric

alphanumeric regular expression in R

故事扮演 提交于 2020-01-11 11:23:08
问题 I am trying to use [:alnum:] as explained on ?regex Anyone knows why grepl("^([a-zA-Z0-9])+([;])", x="dj5sads;adsa") returns TRUE, but grepl("^([:alnum:])+([;])", x="dj5sads;adsa") returns FALSE? 回答1: [:alnum:] is only the name of the class. As you want to put this named class into a character class, you have to enclose it with just another pair of [] : [[:alnum:]] In your example it'd be grepl("^([[:alnum:]])+([;])", x="dj5sads;adsa") //Output: TRUE demo @ ideone 回答2: what you want is grepl(

alphanumeric regular expression in R

*爱你&永不变心* 提交于 2020-01-11 11:23:05
问题 I am trying to use [:alnum:] as explained on ?regex Anyone knows why grepl("^([a-zA-Z0-9])+([;])", x="dj5sads;adsa") returns TRUE, but grepl("^([:alnum:])+([;])", x="dj5sads;adsa") returns FALSE? 回答1: [:alnum:] is only the name of the class. As you want to put this named class into a character class, you have to enclose it with just another pair of [] : [[:alnum:]] In your example it'd be grepl("^([[:alnum:]])+([;])", x="dj5sads;adsa") //Output: TRUE demo @ ideone 回答2: what you want is grepl(

Extract numeric portion from an alphanumeric string in Excel 2010

社会主义新天地 提交于 2020-01-05 03:33:18
问题 I would like to extract all the numbers from an alphanumeric string in excel. I have an excel sheet with list of alphanumeric strings as shown below and I would like to extract all the numbers from the alphanumeric string and store it in a new cell I already tried the below formula found online but it outputs '6' as result but it isn't right, so can anyone please help me with it? SUM(MID(0&A2,LARGE(ISNUMBER(-- MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1))*ROW(INDIRECT("1:"&LEN(A2))), ROW(INDIRECT("1

Return rows where first character is non-alpha

試著忘記壹切 提交于 2020-01-03 18:34:06
问题 I'm trying to retrieve all columns that start with any non alpha characters in SQlite but can't seem to get it working. I've currently got this code, but it returns every row: SELECT * FROM TestTable WHERE TestNames NOT LIKE '[A-z]%' Is there a way to retrieve all rows where the first character of TestNames are not part of the alphabet? 回答1: Are you going first character only? select * from TestTable WHERE substr(TestNames,1) NOT LIKE '%[^a-zA-Z]%' The substr function (can also be called as

Creating Oracle sequence that starts with alphanumeric

时光总嘲笑我的痴心妄想 提交于 2020-01-02 04:35:09
问题 I want to create sequence to start with character inv and increment by 1 The values to be INV01 INV02 INV03 etc... CREATE SEQUENCE invoice_nun START WITH "INV" INCREMENT BY 1 回答1: Only integer valued sequences can be created. So the statement must be: CREATE SEQUENCE invoice_nun START WITH 1 INCREMENT BY 1; You can convert the fetched value to a string and add an appropriate prefix. select 'INV'||to_char(invoice_nun.nextval,'FM09999999') from dual; You can create a function to simulate a

Strip down everything, except alphanumeric and European characters in PHP

倾然丶 夕夏残阳落幕 提交于 2020-01-01 13:56:09
问题 I am working on validating my commenting script, and I need to strip down all non-alphanumeric chars except those used in Western Europe. My plan is to regex out all non-alphanumeric characters with: preg_replace("/[^A-Za-z0-9 ]/", '', $string); But that so far strips out all European characters and a £ sign, so "Café Rouge" becomes "Caf Rouge". How can I add an array of Euro chars to the above regex. The array is: £, €, á, à, â, ä, æ, ã, å, è, é, ê, ë, î, ï, í, ì, ô, ö, ò, ó, ø, õ, û, ü, ù,

Increasing Alphanumeric value in user defined function

别等时光非礼了梦想. 提交于 2019-12-31 03:21:27
问题 I'm trying to code a user defined function under SQL Server 2005 that will increase integer part of alphanumeric value by one. For example, uf_AlphanumericIncrease ('A000299') should return 'A000300'. Here's what I've done so far; ALTER FUNCTION uf_AlphaNumericIncrement ( @ID varchar(10) ) RETURNS VARCHAR(10) AS BEGIN DECLARE @RES varchar(10); IF SUBSTRING(@ID,LEN(@ID),1)='9' SET @RES=SUBSTRING(@ID,1,LEN(@ID)-2)+CAST (CAST(SUBSTRING(@ID,LEN(@ID)-1,1) AS smallint)+1 AS VARCHAR(10))+'0'; ELSE

How do I sort strings alphabetically while accounting for value when a string is numeric?

社会主义新天地 提交于 2019-12-27 11:02:34
问题 I'm trying to sort an array of numbers that are strings and I'd like them to sort numerically. The catch is that I cannot convert the numbers into int . Here is the code: string[] things= new string[] { "105", "101", "102", "103", "90" }; foreach (var thing in things.OrderBy(x => x)) { Console.WriteLine(thing); } output: 101, 102, 103, 105, 90 I'd like: 90, 101, 102, 103, 105 EDIT: The output can't be 090, 101, 102... Updated the code sample to say "things" instead of "sizes". The array can

PHP regular expression to match alpha-numeric strings with some (but not all) punctuation

自闭症网瘾萝莉.ら 提交于 2019-12-24 22:37:01
问题 I've written a regular expression in PHP to allow strings that are alpha-numeric with any punctuation except & or @ . Essentially, I need to allow anything on a standard American keyboard with the exception of those two characters. It took me a while to come up with the following regex, which seems to be doing what I need: if (ereg("[^]A-Za-z0-9\[!\"#$%'()*+,./:;<=>?^_`{|}~\-]", $test_string)) { // error message goes here } Which brings me to my question... is there a better, simpler, or more

Generating 5 digit alphanumeric code with predifined characters in sequence

江枫思渺然 提交于 2019-12-24 10:38:02
问题 I would like to generate a membership number consisting of alphanumeric characters, removing i o and l to save confusion when typing. to be done in php (also using Laravel 5.7 if that matters - but i feel this is a php question) If simply using 0-9 the membership number would start at 00001 for the 1st one and the 11th person would have 00011. I would like to use alphanumeric characters from 0-9 + a-z (removing said letters) 0-9 (total 10 characters), abcdefghjkmnpqrstuvwxyz (total 23