A simple question in Javascript Regex

Google is failing because? = not searchable. What is he doing

(?=[aeiouy])

match - specifically? =, I know that [aeiouy] is any of aeiouy.

+3
source share
4 answers

?=The syntax is a positive lookahead , it matches any followed by a vowel.

+6
source

It corresponds to any place where the next character - a, e, i, o, uor y, but it does not correspond to this symbol - see. Http://www.rubular.com/r/Tjq3ocLMVJ

, (?=...) "lookahead",

+5

MDC:

x (? = y)

x, x y.

,/Jack (? = Sprat)/ "Jack", "Sprat". /Jack (? = Sprat | Frost)/ "Jack", "Sprat" "Frost". , "", "" .

:

foo(?=[aeiouy])

fooe, fooi .., foo, , , .

+3

Say your string is “bbbbae”, then “(? = [Aeiouy])” matches either “a” or “e” when applied anywhere before “a”.

0
source

Source: https://habr.com/ru/post/1780285/


All Articles