How can I use regex for "contains this word"

12,233

You don't need a regex for an exact string match, but if you must:

/#\/thankYou/

or as @Sundar points out, you may not need to escape anything:

#/thankYou
Share:
12,233

Related videos on Youtube

user2548261
Author by

user2548261

Updated on July 08, 2022

Comments

  • user2548261
    user2548261 almost 2 years

    I'm trying to setup tracking in Google Analytics.

    The goal URL is:

    www.example.com/jdsfdf?sdfffs#/thankYou
    

    Every time Google Analytics sees #/thankYou in the URL, I want it to attribute that as a conversion.

    How can I use regex to say if the URL contains #/thankYou, then it's a conversion?

    • Sam I am says Reinstate Monica
      Sam I am says Reinstate Monica over 10 years
      the regex sould be as simple as the (escaped) string you're looking for.
  • Sundar R
    Sundar R over 10 years
    I don't know if Google Analytics asks the regex to be surrounded by // characters (support.google.com/analytics/answer/1034324?hl=en does not mention it), but if it does not, we don't even need to escape the /, it's just the exact literal string #/thankYou