1

Need some help to write a regex that catches this

/applicant-resume-upload?tfa_3352=ANYCHARACTERS

but not this

/applicant-resume-upload?tfa_3352=

(blank instead of any characters for the value).

1
  • How much of that string is constant ? What do you mean by blank ? Does it mean not end of string or not whitespace ? What should be matched in applicant-resume-upload?tfa_3352=tfa_3352= ? Commented Oct 29, 2014 at 18:41

3 Answers 3

2
\/applicant-resume-upload\?tfa_3352=(?!$|\s+).*

This should do it.It will ensure that it is not the end of line or space or newlines..

See demo.

http://regex101.com/r/sU3fA2/48

Sign up to request clarification or add additional context in comments.

4 Comments

do the special characters in the 'static' part also need to be escaped? the initial forward slash, the question mark, and the equal sign...
just a follow up too, like i clarified to the other commenter in the answer above - i'm looking for the regex that matches "not blank" (1st example) and fails "blank" (2nd example).
i'm thinking \/applicant-resume-upload\?tfa_3352\=(?!$|\s+) ... i'm looking for syntax that would work for google analytics goal path regex, i think that's JS regex engine but not 100% sure. the above works for me in a test at regex101.com, but the initial regex without the escapes did not.
@dubesor for js the regex will have to be escaped.But i got no knowldege of that.See demo to check regex.
1

Based on some of your other comments it sounds like you can't use lookarounds? I'm pretty sure most javascript engines have at least partial support for them, but if that's not the case for you then this pattern should work.

\/applicant-resume-upload\?tfa_3352=.+

Or if you need to exclude white space then this

\/applicant-resume-upload\?tfa_3352=\S+

http://regex101.com/r/kH2xX7/1

1 Comment

i'm not sure, but i think google analytics may be able to use lookarounds. i'm trying the previously suggested pattern \/applicant-resume-upload\?tfa_3352=(?!$|\s+).* as my goal URL and will report back whether it works correctly.
0

don't understand you want blank or not.

no blank:

\/applicant-resume-upload\?\w+=\S+

3 Comments

@dubesor so it's the first case. \S means any character but blank.
thanks. and would it be this when the 'static' delimiters are escaped? \/applicant-resume-upload\? ... etc. you're also cutting off the lookup at that 1st question mark so both cases would match. i'm actually looking for "not blank after = sign"
@dubesor i escaped some characters to make it perl compatible. modify the match your own engine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.