× Here you can get community support related to ReDJ.

Extract data from within an URL

More
10 years 1 month ago #3205 by cappu
Extract data from within an URL was created by cappu
Hi Luigi,

I need you help.

I have hundreds of From-URL like this:

/ihresuche..Bischafsheim%20(bei%20R%c3%bcsselheim)..php

I want to redirect to this
/tierspezialistensuche?searchstring=Bischafsheim%20(bei%20R%c3%bcsselheim)

Where "Bischafsheim%20(bei%20R%c3%bcsselheim)" could be any string with any length.
Ideal would be a a ltrim of "/ihresuche.." and a rtrim of "..php"

Thanks for any ideas

Kind regards,

Bernhard

Please Log in or Create an account to join the conversation.

More
10 years 1 month ago #3207 by admin
Replied by admin on topic Extract data from within an URL
Hi Bernhard,
assuming th ".." are real (if not this will not work), try this:
From URL: ^/ihresuche\.\.
To URL: {scheme}://{siteurl}/tierspezialistensuche?searchstring={preg_match 1}/\/ihresuche\.\.(.*)\.\.php$/i{/preg_match}
Request only: true (checked)

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

More
10 years 1 month ago #3210 by cappu
Replied by cappu on topic Extract data from within an URL
Hi Luigi,

it works! Thank you so much! - This is awesome. :cheer:

BTW: Did you consider to change the field "To URL *" to an textarea? - For larger Regex statements a textfield is hard to read.

Kind regards,

Bernhard

Please Log in or Create an account to join the conversation.

More
10 years 1 month ago #3211 by admin
Replied by admin on topic Extract data from within an URL
Yes,
is in my plans, but consider that using placeholders allow to have a very short "To URL", and this is why I postponed this change.

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

Time to create page: 0.171 seconds