Hi all!
I am pretty bad in regular exoressions but think my problem can be solved with it...
Basically, I have a feature that will copy all db rows (type=text) for one user to another and thus create new (auto-incremented pageId:s) db rows. In some fields there are URL references to other rows (unique pageId) and that's where my problem is.
I need to perform the following:
- Loop through each row for user A
- For each row, copy the row in the dB to user B and store original_pageId and created_pageId in an array
- After all rows are copied: Loop through each row for user B and find all occurences of string "/users/index.php?pageId="
- In php, grab whatever comes after the 'pageId=' (can be 3, 99, 862... any integer)
- Find the pageId in the array to retrieve the new, created_pageId
- Replace in the db e.g. "/users/index.php?pageId=243" with "/users/index.php?pageId=1442"
Did I make it clear?
If so, is this a good approach or can I somehow use regexp to get "whatever comes after the 'pageId'"?
Thanks!
/Claes