M
M
Maxim Timofeev2016-05-05 18:05:57
PHP
Maxim Timofeev, 2016-05-05 18:05:57

How to write a regular expression "find everything up to the question mark"?

It's been a long time and now I decided to master regular expressions.
I climbed a bunch of information and examples, but for the life of me I don’t understand how it is written “find everything before” or “find everything after”
here is an example:

$value = 'https://toster.ru/question/new?id=vasya';
$links = preg_replace('/*\?/','',$value);

An error pops up

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2016-05-05
@webinar

https://regex101.com/r/kD6eX3/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question