Regex find a word with lookbehind

Hi,

I’m learning regex code, i did this to integrate it with a project.

(?<=:)[password]$

login as: sba
srv@ip’s password:

it starts from the end, but can’t find the word password.

Thanks

Try using round parenthesis. Because as it is this will match one single letter of those inside it

1 Like

Hi @ieahleen

I did with round parenthesis, same issue…

https://regex101.com/r/heeEEr/4

Lookbehinds are currently supported only in chrome, so check that.
Now, what are you exactly trying to achieve?

1 Like

Hi @vytautas-pilk

I’m trying to learn regex and work on my project…

The thing i need to find the word password, if it matches i get to type a text otherwise i don’t…

Btw, i’m programming on UiPath.

Thanks

Then your regex is /password/. Or, with a positive lookahead to check for a colon: /password(?=:)/. It finds the word ‘password’ in your string. Not sure why would you need a positive lookbehind, may you elaborate, please?

1 Like

Thank you @vytautas-pilk

Can you please explain to me why did you took off “<”.

I did follow an example on the forum, and unterstand how they check for the words etc, and following a course, to learn more about regex. I ll need it a lot.

Your welcome. You used positive lookbehind, and I used positive lookahead, that’s why I omitted ‘<’ character. You need positive lookbehinds when you want to match a string/pattern when it’s preceded by something else, and the opposite for positive lookaheads when it is preceding something else.

1 Like

Got it, thank you @vytautas-pilk