I have some URL. I want to find out which is correct and which is wrong URL.
URL's are
https://ww.zomato.com/bangalore/srinathjis-cafe-basavanagudi?context=eyJzZSI6eyJlIjpbIjE4NTkzNTE5IiwiMTg1MDAwMjAiLCIxODg0NDI2MCIsIjU3OTk0Iiw1NTA5MCwiNTc0MzUiXSwidCI6IkNhZlx1MDBlOXMgYW5kIERlbGlzIGluIEJhbmFzaGFua2FyaSJ9fQUTR
https://www.zomato.com/bangalore/spice-elephant-banashankari?context=eyJzZSI6eyJlIjpbIjU4Njk0IiwxODM3NTQ3NCwiNTkwOTAiLCIxODM4Mjk0NCIsIjE4MjI0Njc2IiwiNTkyODkiLCIxODM3MzM4NiJdLCJ0IjoiUmVzdGF1cmFudHMgaW4gQmFuYXNoYW5rYXJpIHNlcnZpbmcgQnVmZmV0In
http://www.zomato.com/bangalore/cafe-nova-banashankari?context=eyJzZSI6eyJlIjpbIjE4NTI5MDkwIiwiNTYxNjYiLCI2MDkxOSIsIjE4Mzk2NzYwIiwxODU5MzUxOSwiMTg1MDAwMjAiLCIxODg0NDI2MCIsIjU3OTk0IiwiNTUwOTAiLCI1NzQzNSJdLCJ0IjoiQ2FmXHUwMGU5cyBhbmQgRGVsaXMgaW4gQmFuYXNoYW5rYXJpIn19=
ttps://www.zomato.com/bangalore/cuppa-1-banashankari?context=eyJzZSI6eyJlIjpbIjE4Mzk2NzYwIiwiMTg1OTM1MTkiLCIxODUwMDAyMCIsIjE4ODQ0MjYwIiw1Nzk5NCwiNTUwOTAiLCI1NzQzNSJdLCJ0IjoiQ2FmXHUwMGU5cyBhbmQgRGVsaXMgaW4gQmFuYXNoYW5rYXJpIn19
Here is the sample code
^(https://www.|http://www.)[a-zA-Z\.//-] \?[a-zA-Z0-9=]
Here I am able to filter 2 URL but I don't those URL which is ending with equal(=) operator I mean at the end of the URL it should not contain any = operator
You can use https://regexr.com/3gjtt online tool to validate
CodePudding user response:
As mentioned by @mplungjan start with escaping special characters and use negative lookbehind for that ending '='