-2

I need to use regular expressions to draw all the individual letters from the entire sentence, and the result must be in only one group, it can not be a separate group. E.g:

This is an example sentence in which I have two letters:

a and b

Score:

Match: ab

Below is my regex, and one most important thing, befor i can't use regex with: "(?<!"

\b[A-Za-z]\b

So far I have:

Match1: a
Match2: b
Casimir et Hippolyte
  • 88,009
  • 5
  • 94
  • 125

1 Answers1

0

There are two ways I would recommend.

  1. Match just the stand alone word chars in a global match. This will get them into a list.

(?<!\w)\w(?!\w)

https://regex101.com/r/uKNMg1/1

  1. Use the split function with this regex which is the inverse of the one above.
    This removes all the multiple word chars and puts the letters into a list.

(?s)(?:(?!(?<!\w)\w(?!\w)).)+

https://regex101.com/r/pJtRdp/1