adam84 Posted November 12, 2010 Share Posted November 12, 2010 I am having trouble with preg replacing What I want to do is remove any [1] from the text. Example: Today is cold outside[1]. I want: Today is cold outside. This is what I got $txt = "Today is cold outside[1]."; return preg_replace( "/[\d+/]", "", $txt); Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 12, 2010 Share Posted November 12, 2010 You haven't included the square brackets in the pattern, and you left off the ending delimiter. preg_replace( "/[\[\d+\]]/", "", $txt); Quote Link to comment Share on other sites More sharing options...
adam84 Posted November 12, 2010 Author Share Posted November 12, 2010 I just figured it out and I came back to make my correction, but you already posted it. Thanks though, sorry for wasting your time Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.