
hydpm
User
Sep 5, 2008, 1:01 PM
Post #1 of 2
(6337 views)
|
Regex Help for Search and replace
|
Can't Post
|
|
Need the Regular Expression for the below stuff: $input Variable may have one of the followng: $input = '1 h' ; $input = '2 h'; etc. We need to search and repalce as follow: - if the $input= '1 h' ; then it should be converted to "1 hour"
- If the $input ='2 h'; then it shoulf be converted to "2 hours"
The difference is when it is other than 1 then the h will be converted to hours a plural . if it '1 h' then h will be converted to '1 hour'. Thanks, Raj
|