Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38077 > unrolled thread
| Started by | ms.2052001@gmail.com |
|---|---|
| First post | 2020-01-17 00:50 -0800 |
| Last post | 2020-01-19 15:45 -0800 |
| Articles | 12 — 7 participants |
Back to article view | Back to comp.lang.javascript
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
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
| From | ms.2052001@gmail.com |
|---|---|
| Date | 2020-01-17 00:50 -0800 |
| Subject | Re: Isalpha, isalnum in Javascript? |
| Message-ID | <98f3c647-877c-4602-b411-d319aee4b159@googlegroups.com> |
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);
[toc] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2020-01-17 23:05 +0700 |
| Message-ID | <gzgch91f5fa2$.1nsx86ho875i7$.dlg@40tude.net> |
| In reply to | #38077 |
On Fri, 17 Jan 2020 00:50:09 -0800 (PST), ms.2052001@gmail.com wrote: > 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); I taut I taw a millennial.
[toc] | [prev] | [next] | [standalone]
| From | dr.j.r.stockton@gmail.com |
|---|---|
| Date | 2020-01-17 13:07 -0800 |
| Message-ID | <8969187b-2635-4244-bf4b-27228ce403ec@googlegroups.com> |
| In reply to | #38078 |
On Friday, 17 January 2020 16:05:20 UTC, JJ wrote: > On Fri, 17 Jan 2020 00:50:09 -0800 (PST), ms.2052001#gmail.com wrote: > > On Friday, 2 January 1998 10:00:00 UTC+2, A.P. wrote: > >> Hello, > > ... > > var isAlpha = (c) => (/[A-Za-z]/).test(c); > > I taut I taw a millennial. Indeed. The answers given might have been reasonable in those far-off days, but appear inadequate now, except for those who believe that the only real characters are those on the keyboard of an American PC. ISTM that Java has a Character entity, with methods such as Character.getType(), and that Java can access many sorts of information about characters which we here could write as \u0000 to \uFFFF - and higher. So : what information can modern JavaScript obtain about Unicode characters such as the single characters `xi` and `XI` and strange characters existing in Eastern alphabets such as Danish, Russian, Japanese ... ? -- (c) John Stockton, near London, UK. Using Google Groups. | Mail: J.R.""""""""@physics.org - or as Reply-To, if any. |
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2020-01-18 21:01 +0700 |
| Message-ID | <12dmm3bgzfi0a.130p9vr5qfqoj.dlg@40tude.net> |
| In reply to | #38079 |
On Fri, 17 Jan 2020 13:07:27 -0800 (PST), dr.j.r.stockton@gmail.com wrote: > > So : what information can modern JavaScript obtain about Unicode > characters such as the single characters `xi` and `XI` and strange > characters existing in Eastern alphabets such as Danish, Russian, > Japanese ... ? Only the code point.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2020-01-18 19:13 +0100 |
| Message-ID | <11458437.O9o76ZdvQC@PointedEars.de> |
| In reply to | #38083 |
JJ wrote: > On Fri, 17 Jan 2020 13:07:27 -0800 (PST), dr.j.r.stockton@gmail.com wrote: >> So : what information can modern JavaScript obtain about Unicode >> characters such as the single characters `xi` and `XI` and strange >> characters existing in Eastern alphabets such as Danish, Russian, >> Japanese ... ? > > Only the code point. Much more after reading in the Unicode Character Database (BTDT in my JSX, see UnicodeData.js, UnicodeData.txt, and jsx.regexp.RegExp in regexp.js): <http://www.unicode.org/ucd/> <https://stackoverflow.com/a/8568325/855543> (my answer in 2011) -- PointedEars FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2020-01-17 21:10 +0000 |
| Message-ID | <87pnfhbxht.fsf@bsb.me.uk> |
| In reply to | #38077 |
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.
[toc] | [prev] | [next] | [standalone]
| From | dr.j.r.stockton@gmail.com |
|---|---|
| Date | 2020-01-18 02:42 -0800 |
| Message-ID | <a9a9390a-ebff-443d-8dbe-a46809f08caa@googlegroups.com> |
| In reply to | #38080 |
On Friday, 17 January 2020 21:10:12 UTC, Ben Bacarisse wrote:
> If you have ECMAScript 9, you can use
Well, yes, but for Web authors the need must be for the readers to have ECMAscript 9.
> /\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.
My up-to-date Firefox 72.0.1 (64-bit) then appears not to have ECMAScript 9. Is there now a way in ECMAScript to determine the ECMAScript version number?
H'mm - if there is such a way, it would be necessary, I suppose, to use the above RegExp within try...catch, and compose a moderately graceful failure.
--
(c) John Stockton, near London, UK. Using Google Groups. |
Mail: J.R.""""""""@physics.org - or as Reply-To, if any. |
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2020-01-18 21:01 +0700 |
| Message-ID | <57lnu6tx1cq0$.123btwkjawmj6.dlg@40tude.net> |
| In reply to | #38081 |
On Sat, 18 Jan 2020 02:42:22 -0800 (PST), dr.j.r.stockton@gmail.com wrote: > > My up-to-date Firefox 72.0.1 (64-bit) then appears not to have ECMAScript > 9. Is there now a way in ECMAScript to determine the ECMAScript version > number? Probably not. > H'mm - if there is such a way, it would be necessary, I suppose, to use > the above RegExp within try...catch, and compose a moderately graceful > failure. It can be determined by checking feature presence and/or functionalities.
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2020-01-18 12:13 -0800 |
| Message-ID | <213aad31-6be7-43a0-a632-95e9a3f86305@googlegroups.com> |
| In reply to | #38081 |
On Saturday, January 18, 2020 at 4:42:29 AM UTC-6, dr.j.r...@gmail.com wrote: > On Friday, 17 January 2020 21:10:12 UTC, Ben Bacarisse wrote: > > > If you have ECMAScript 9, you can use > > Well, yes, but for Web authors the need must be for the readers to have ECMAscript 9. There is a babel plugin for this: <https://babeljs.io/docs/en/next/babel-plugin-proposal-unicode-property-regex.html> with an example: <https://mothereff.in/regexpu#input=var+regex+%3D+/%5Cp%7BScript_Extensions%3DGreek%7D/u%3B&unicodePropertyEscape=1>
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2020-01-19 10:07 -0800 |
| Message-ID | <37a580b9-8b3c-49a1-bbea-fe624fc80209@googlegroups.com> |
| In reply to | #38080 |
On Friday, 17 January 2020 22:10:12 UTC+1, Ben Bacarisse wrote:
> 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);
You would use Unicode code points in character ranges, as in the last
example here:
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes>
> If you have ECMAScript 9, you can use
>
> /\p{Letter}/u
If all you have is a hammer...
> as the pattern to match all Unicode characters with property
> General_Category = Letter. Still not 100%, but it might be what's
> wanted.
LOL. Haven't you and the others noticed that you are replying to a thread
from 1998? As far as I remember, at the time JS didn't have RegExp at all,
and even a quite limited support (certainly browser-wise) for Unicode in
strings: which is the reason for that question...
Julio
[toc] | [prev] | [next] | [standalone]
| From | dr.j.r.stockton@gmail.com |
|---|---|
| Date | 2020-01-19 15:39 -0800 |
| Message-ID | <3f761959-6713-4b80-807d-1027b9bb5278@googlegroups.com> |
| In reply to | #38095 |
On Sunday, 19 January 2020 18:07:34 UTC, Julio Di Egidio wrote: > LOL. Haven't you and the others noticed that you are replying to a thread > from 1998? One does not reply to a thread; one replies to an article. My first article in the thread was only technically a Reply; in essence, it proposed renewing the question. > As far as I remember, at the time JS didn't have RegExp at all, > and even a quite limited support (certainly browser-wise) for Unicode in > strings: which is the reason for that question... That may depend on which parts of 1998 you remember. I am holding David Flanagan's JavaScript Pocket Reference, First Edition, October 1998. Its Object Reference part includes a RegExp section (Availability, Core JavaScript 1.2), and its description of the String Data Type says that ECMA-262 requires support of full 16-bit Unicode. It does say that IE4 supports Unicode but Navigator 4 does not. His Definitive Guide, 3rd Edn, says much the same, at greater length; the Preface is dated April 1998, publication June 1998. -- (c) John Stockton, near London, UK. Using Google Groups. | Mail: J.R.""""""""@physics.org - or as Reply-To, if any. |
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2020-01-19 15:45 -0800 |
| Message-ID | <e371b1b6-89d9-4579-a857-0e16a4c0944a@googlegroups.com> |
| In reply to | #38104 |
On Monday, 20 January 2020 00:39:53 UTC+1, dr.j.r...@gmail.com wrote: > On Sunday, 19 January 2020 18:07:34 UTC, Julio Di Egidio wrote: > > > LOL. Haven't you and the others noticed that you are replying to a thread > > from 1998? > > One does not reply to a thread; one replies to an article. My first article > in the thread was only technically a Reply; in essence, it proposed renewing > the question. Besides that it's not an article but just a technical question, I hadn't even mentioned it but it is actually VERY inappropriate to resurrect years old threads, you guys still can't get your head around the fact that this is not a forum and you are rather messing up with the Usenet ARCHIVE. I mean, I am even being charitable, you guys have no fucking clue... HTH and EOD. Julio
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web