Jump to content

Recommended Posts

Hi, I want to check two things if some one could help thanks. I am not an expert at REGEX just learning.

 

Firstly I want to check if a string has a - at the end for example.

 

$string= "Lion"; There is no - at the end  I would like to add a  ( - )  . So $string becomes LION-

 

Second thing I want to check for example if the user has inputted some excessive use of BLANK SPACE and turn it  in to just single space for example.

 

I                      ROCK                  THIS          becomes  I ROCK THIS.  Thanks help is much appreciated.     

 

       

Link to comment
https://forums.phpfreaks.com/topic/230404-checking-a-few-strings/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.