How to use regex to check if a javascript string contains a pattern #shorts

preview_player
Показать описание
Regex is very useful, be sure to take time to learn it.

My VSCode Extensions:
- theme: material community high contrast
- fonts: Menlo, Monaco, 'Courier New', monospace
- errors: Error Lens
- extra git help: Git Lens
- tailwind css intellisense
- indent rainbow
- material icon theme
- prettier & eslint
- ES7+ React Snippets

------------

Рекомендации по теме
Комментарии
Автор

Regular Expressions is the only thing that can make me drop to the floor crying uncontrollably with my thumb in my mouth 😢

alpachino
Автор

The g is not needed when simply testing for presence, creates a problem if you were to run the re.test again:

const text1 = "something dog5 is great";
const text2 = "cat1 foo";

const re = /[a-z]+\d/g

console.log(re.test(text1)); // true
console.log(re.test(text2)); // false

re.test(text2) should return true, but the global flag causes regex to assume that you want to check for next matches (at later index than dog5) instead of starting from the beginning

zir
Автор

You can do some crazy stuff with your regex. Nice video

armandopenatamayo
Автор

not a channel, but a treasure trove of useful information 🔥

КириллМохначевский-ою
Автор

First time I understand something on regex. Thanks

AntonioSantos-vezv
Автор

There it is again. "We use a ReGular Expression, also called ReJex"

YamiSuzume
Автор

Im pretty good with regexes, except for look arounds, I tend to have to always have to look up how those work again, and I think named groups is a thing, I would have to check back how they work, and some of the shortforms for any whitespace, etc.

But I am good with the . ? + * ^ […] {n, m} {n, } and {, n} symbols and the meaning of an odd vs even chain of \ and know what the /.../g g means and I think there is also /.../i i for ignorecase, and I know what greediness means.

legitjimmyjaylight
Автор

Nice ! And the red text behind each line is extension or something ?

giyuu
Автор

Can you do a javascript to python comparison? like the things you can do in javascript that you can similarly do in python?

TheFootballPlaya
Автор

Man you broke down Regex the easiest I’ve ever seen lol. Thx

kimbapslayer
Автор

Can you make a tutorial for RegEx please. Its so confusing

patriotir
Автор

What are the extensions you use in VSCode?

ishanmaduranga
Автор

What’s the point of the re.test(text) and not directly re.test why wouldn’t it work?

melih.a
Автор

Of course now this regexp works only for english text, as other languages use chars outside the ASCII range a-z... 🤷‍♂️

RolandGiersig
Автор

Amazing! just need to know that [a-z]+ means more than one character?

aamiramin
Автор

Guys, DON'T WASTE YOUR TIME learning regex expressions; they are immensely difficult to learn. There are websites that will write regex patterns for you, you just describe what you want the regex to do and it will give you the code instantly.

dizzyrocket
Автор

Also known as a "rejex" .? I thought it was a regex

zabiulahmed
Автор

how is the output show next to code while he write the code show him their error or what ever

ahmedmohammed-wiqp
Автор

So, I'm (beginner?) in a programming. But why everyone uses constants everywhere?!

dkorjey