Need Regex Help Please

Hello

I am super new to regex and im trying to nail down 2 separate regular expressions.

I need a regex that will extract everything after the words “description=”

  1. Test field is:

description=Account Locked Out

For the 2nd one, I need to extract everything after the words "Client Computer : "

  1. Test field is:

Client Computer : XYZ1234

Can someone please be so kind as to help a newbie out with these 2 expressions?

Thank you

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at https://www.freecodecamp.org/learn.

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

It is pretty typical on here for people to share a codepen / repl.it / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile:

@frankfooter32 Also, specify what language you are writing the regular expression (i.e. JavaScript). It can make a difference sometimes.

Also, what exactly do you mean by “extract everything after the words…”? For example, what if the string was?

description=ClientComputer:pc

What do you expect to be extracted in the first regex?

Giving us a more complete example string, would give us better context of what you are trying to achieve.

Randell

I meant anything after the “=” sign.

So description=Account locked out. I would want to capture anything after the “description=” part of the string. But stop at the end, as its part of a payload. The interesting part is that right after the part im trying to capture, there is a “CN=” value that could be used to perhaps end the regex.

This is for Java script by the way

Thanks

Show us the code you have tried so far and we can try to guide you to a solution you can call your own.

So when you say “end”, do you mean the end of a line in a file? Can the part that needs to be captured after the = be multiple lines of text?

If you haven’t discovered it yet, regex101.com is my absolute favorite tool for working out a regular expression.

1 Like