-1

I've worked with REGEX for super simple stuff.

Now I came up with a situation that my knowledge isn't sufficient.

I need to get this info out of a lot of lines.

Everything after the first quotes and before the @ sign is what I need to have to copy to a new file.

0: "mailname@…"
6: "mailname2@yahoo.com"

etc..

I first did the following

(?<=")\S\D[^"]+(?=")

But this takes everything in between the quotes. But it should exclude everything out of the quotes and just give me the mail address or the name before the @ sign.

3
  • This is probably not a topic for this site since it're not releted to testing. – pavelsaman Feb 23 at 14:11
  • which origramming language what are you trying to do – PDHide Feb 23 at 17:04
  • This question is more suitable for StackOverflow rather than SQA StackExchange. – IAmMilinPatel Feb 24 at 6:20
0

I don't know what tool you're using, so I use what's most promptly available to me.

$ cat input
0: "mailname@…"
6: "mailname2@yahoo.com"

and getting your desired output with sed:

$ sed -n "s/.*[\"]\(\S*\)[@].*/\1/p" input > output
$ cat output
mailname
mailname2

Not the answer you're looking for? Browse other questions tagged or ask your own question.