D
D
doitden2014-09-01 18:10:09
PHP
doitden, 2014-09-01 18:10:09

Regular expressions and/or how to describe?

there are 2 lines
-1.2964505 (always present)
and
?pagereq=1 (not always present)
how to describe a regular expression for such a case
that -1.2964505 could be both separately and together with ?pagereq=1
Example -1.2964505?pagereq=1
my version is like this, but it doesn't quite work
\-(1\.[0-9]{7})?(\?pagereq.*)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-09-01
@doitden

/^\-1\.2964505(\?pagereq=(\d+))?$/Ui
ideone.com/vlDAVn

D
doitden, 2014-09-03
@doitden

Solution found.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question