-1

I want to write a JAVASCRIPT regex for selecting the words with only alphabet characters in the paragraph.

eg.

Input = My name is Apple iPhone 6S. My price is dollar 499. My RAM is 2GB. Output = My/name/is/Apple/iPhone/My/price/is/dollar/My/RAM/is

I know that the regex is used for the pattern matching not for making the runtime decisions based on the pattern. Please help.

Prateek
  • 135
  • 3
  • 15
  • Possible duplicate of [Regular expression for match all words without numbers](https://stackoverflow.com/questions/29375632/regular-expression-for-match-all-words-without-numbers) – Shinra tensei Dec 12 '17 at 10:57

1 Answers1

0

You can use word boundaries, such as:

(\b[a-zA-Z]+)

to only match words with letters from a-z and A-Z.

JCJ
  • 303
  • 3
  • 13