Using an escape character with a beginning wildcard in regex in c# -


below sample of email using database:

2.2|[johnnyappleseed@example.com] 

every line different, , may or may not email, always. trying use regular expressions information inside brackets. below have been trying use:

^\[\]$ 

unfortunately, every time try use it, expression isn't matching. think problem using escape characters, not sure. if not how use escape characters this, or if wrong completely, please let me know actual regex should be.

close yours ^.*\[(.*)\]$:

  • ^ start of line
  • .* anything
  • \[ bracket, indicating start of email
  • (.*) (the email), capturing group
  • \] square bracked, indicating end of email
  • $ end of line

note regex missing .* parts match things between key characters [ , ].


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -