S
S
Stanislav2018-01-30 23:40:04
JavaScript
Stanislav, 2018-01-30 23:40:04

Regular expression: url starts and url ends?

Greetings!
Need regular expression to fire trigger in Google Tag Manager ("PagePath matches regular expression")
URL starts with /katalog and ends with /
Looks like this: /katalog/some-url/.../some-url/
This didn't work
^\/katalog*\/$

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-01-30
@Chebaa

Dot before asterisk
^\/katalog.*\/$

B
Bernard Krapivin, 2018-01-30
@Bobrodon

Can be default if'om

if ((str.charAt(0) == "/katalog") && (str.charAt(str.length - 1) == "/")) {
    // Стринга совпала
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question