Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38080
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Isalpha, isalnum in Javascript? |
| Date | 2020-01-17 21:10 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <87pnfhbxht.fsf@bsb.me.uk> (permalink) |
| References | <34ACCD99.539E361@apdo.com>#1/1> <98f3c647-877c-4602-b411-d319aee4b159@googlegroups.com> |
ms.2052001@gmail.com writes:
> On Friday, 2 January 1998 10:00:00 UTC+2, A.P. wrote:
>> Hello,
>> I would like to know if there's a way to check if a character is
>> alphanumeric or if it belongs to a certain class of characters without
>> having to check explicitly for all the cases with an endless if. I've
>> tried with character>='A' and also with the Ascii code but I had no
>> success.
>> Please answer to my mailbox too. Thank you very much in advance.
>
>
> You can use regex expressions to check, but it will check for English letters,
> code:
> var isAlpha = (c) => (/[A-Za-z]/).test(c);
If you have ECMAScript 9, you can use
/\p{Letter}/u
as the pattern to match all Unicode characters with property
General_Category = Letter. Still not 100%, but it might be what's wanted.
--
Ben.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Isalpha, isalnum in Javascript? ms.2052001@gmail.com - 2020-01-17 00:50 -0800
Re: Isalpha, isalnum in Javascript? JJ <jj4public@vfemail.net> - 2020-01-17 23:05 +0700
Re: Isalpha, isalnum in Javascript? dr.j.r.stockton@gmail.com - 2020-01-17 13:07 -0800
Re: Isalpha, isalnum in Javascript? JJ <jj4public@vfemail.net> - 2020-01-18 21:01 +0700
Re: Isalpha, isalnum in Javascript? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-01-18 19:13 +0100
Re: Isalpha, isalnum in Javascript? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-01-17 21:10 +0000
Re: Isalpha, isalnum in Javascript? dr.j.r.stockton@gmail.com - 2020-01-18 02:42 -0800
Re: Isalpha, isalnum in Javascript? JJ <jj4public@vfemail.net> - 2020-01-18 21:01 +0700
Re: Isalpha, isalnum in Javascript? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-18 12:13 -0800
Re: Isalpha, isalnum in Javascript? Julio Di Egidio <julio@diegidio.name> - 2020-01-19 10:07 -0800
Re: Isalpha, isalnum in Javascript? dr.j.r.stockton@gmail.com - 2020-01-19 15:39 -0800
Re: Isalpha, isalnum in Javascript? Julio Di Egidio <julio@diegidio.name> - 2020-01-19 15:45 -0800
csiph-web