1

I m trying regex to get the strings

  1. starting with @ and

  2. not ending with a dot(.)

For that i tried the java code(link here) but this does not show any results -

@(\\w+)*(?<!.(.))*$

The string i m trying is -

This is a test\nAnother @pradyut@test ht@html.com\ntest\n#art\n@cool#paintings#collections

This should return

pradyut
test
cool

The result html ending with a .com should not return.

Regards

Pradyut Bhattacharya
  • 5,440
  • 13
  • 53
  • 83

1 Answers1

2

You can use this regex:

(?<=@)\w+\b(?!\.)

In Java you have to use:

(?<=@)\\w+\\b(?!\\.)

Regex Demo

anubhava
  • 761,203
  • 64
  • 569
  • 643