I Want to remove only ?gxt=12sadbsaj=1235\&&&*
from https://www.choicehotels.com/georgia/decatur/quality-inn-hotels/ga908?gxt=12sadbsaj=1235\&&&*
. How can I do that using regex?
Asked
Active
Viewed 23 times
-1

Jean-François Corbett
- 37,420
- 30
- 139
- 188

Raktim Shrestha
- 3
- 1
-
Here's a start: https://stackoverflow.com/tags/regex/info – Jean-François Corbett Aug 31 '17 at 07:54
1 Answers
1
Something like =left(input, find("?", input))
. You might need a + or - 1 in there somewhere. But that'll take the leftmost characters up to the result of the find which will give the number of characters up to the ?.

EvanM
- 667
- 1
- 4
- 12
-
Btw, you asked for regex which is only really available by VBA (https://stackoverflow.com/questions/22542834/how-to-use-regular-expressions-regex-in-microsoft-excel-both-in-cell-and-loops). A regex to match everything up to the '?' would be something like '[^\?]*'. That would match all non-question mark characters from the beginning. – EvanM Aug 31 '17 at 07:51
-
I've found a similar question: https://www.excelforum.com/excel-formulas-and-functions/556799-use-a-formula-to-delete-part-of-a-text-string.html with the following solution: =LEFT(A2,SEARCH("?",A2)-1) A2 being the cell in which the full string is ;) – Kathara Aug 31 '17 at 07:58
-
=LEFT(A2,SEARCH("?",A2)-1) , Search didn't worked for me in spreadsheet but instead of Search FIND worked out perfectly. Thanks a lot – Raktim Shrestha Aug 31 '17 at 08:08