From 266185c8ce61563ff4f91b6fce669cb7e6667c6d Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Thu, 31 Dec 2020 14:01:42 +0200 Subject: [PATCH] Update and rename isAlphabetOnly.md to isAlpha.md --- snippets/isAlpha.md | 18 ++++++++++++++++++ snippets/isAlphabetOnly.md | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 snippets/isAlpha.md delete mode 100644 snippets/isAlphabetOnly.md diff --git a/snippets/isAlpha.md b/snippets/isAlpha.md new file mode 100644 index 000000000..5a823b506 --- /dev/null +++ b/snippets/isAlpha.md @@ -0,0 +1,18 @@ +--- +title: isAlpha +tags: string,regexp,beginner +--- + +Checks if a string contains only alpha characters. + +- Use `RegExp.prototype.test()` to check if the given string matches against the alphabetic regexp pattern. + +```js +const isAlpha = str => /^[a-zA-Z]*$/.test(str); +``` + +```js +isAlpha('sampleInput'); // true +isAlpha('this Will fail'); // false +isAlpha('123'); // false +``` diff --git a/snippets/isAlphabetOnly.md b/snippets/isAlphabetOnly.md deleted file mode 100644 index 3ce1dfbbc..000000000 --- a/snippets/isAlphabetOnly.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: isAlphabetOnly -tags: string,regexp,beginner ---- - -Checks if a string contains only alphabetic characters. -- Use `RegExp.prototype.test()` to check if the input string matches against the alphabetic regexp pattern. - - -```js -const isAlphabetOnly = input => /^[a-zA-Z]*$/.test(input) -``` - -```js -isAlphabetOnly('sampleInput'); // true -isAlphabetOnly('this Will fail'); // false -isAlphabetOnly('123'); // false -```