/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Simple preg_match pattern help?

I need help making a preg_match() pattern — I don’t use the function much, so I never know what will work and what won’t, and what I need is a little too specific to find a complete example so far.

I need to search a string that’s basically got [B][U][COLOR=”#008000″]-000×000.[/COLOR][/U][/B] in it but there can be any number of digits (the 0’s) and they can be any number — so the dash, the x, and the . are framing two numbers of any given length.

I need to find it and, if it’s present, remove it from the string.

[I][B]Any help would be greatly appreciated, as I’m entirely clueless.[/B][/I] ?

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@amandaNHTauthorJul 02.2015 — Found the solution. Here it is in case anyone needs to know:

[CODE]preg_replace('/([-0-9]+x[0-9]+)/','',$str);[/CODE]
×

Success!

Help @amandaNHT spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...