I am having one line I have to replace that below is the line
/myhome/ishere/where/are.you.ha
Here I have a live regex
preg_match('/(.+\/)[^.]+(.+\.ha)/', $input_line, $output_array);
it results me live this
/myhome/ishere/where/.you.ha
But I need a answer like this
/myhome/ishere/where/you.ha
Please anyone help me to remove this dot.
You can use
/^(.+\/)[^.]*\.(.*\.ha)$/
See the regex demo. Details:
^ - start of a string(.+\/) - Group 1: any one or more chars other than line break chars as many as possible and then /[^.]* - zero or more chars other than a .\. - a . char(.*\.ha) - Group 2: any zero or more chars other than line break chars as many as possible and then .ha$ - end of a stringIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With