C
C
Cuba12015-12-22 15:55:46
Regular Expressions
Cuba1, 2015-12-22 15:55:46

How to select from a string only the path to the pdf file?

Good afternoon.
It is necessary that links with pdf files are searched and only the path is selected from the link.
That is, in the line href="/NanoBridgeM2/NanoBridgeM2.pdf". Find and replace /NanoBridgeM2/. We tried this: href="(.+\/)(.+\.pdf) - but in this case, the entire line is found. Please help me solve the problem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Deodatuss, 2015-12-22
@Deodatuss

and if so (\/[^\/]*\/)(.*pdf)$
and so with any nesting, you can get the name pdf (?:\/[^\/]*)*(\/.*pdf) $

V
Vladimir, 2015-12-22
@vintello

try this href="(.+)\/([^\/]+\.pdf)"$
test passed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question