I want to match the nth hyphen in the regular expression.
For example, I would like to know the regular expression that matches and removes the right -fdfd-fd
from the second hyphen from the left in the URL below.
If you want to match it from the first time, it's -.*
.
https://www.example.com/a-12345-fdfd-fd
regular-expression
This is an example of a regular expression to match for the second time
^[^-]*-[^-]*-
You can delete it from the second time to the right with perl
s/^([^-]*-[^-]*)-.+$/\1/
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
578 Understanding How to Configure Google API Key
611 GDB gets version error when attempting to debug with the Presense SDK (IDE)
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.