Regex to Find All Checkboxes

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
tommyready
Forum Newbie
Posts: 6
Joined: Mon Feb 26, 2007 12:41 am

Regex to Find All Checkboxes

Post by tommyready »

Hey everyone,

I'm having some problem with regex and replacing certain content. All my forms are stored in a field of a table and so when they are queried they all have a checkbox next to a field if it is required. I want to find all checkboxes and replace them with either <em>*</em> or '' (blank space).

Here is what I'm trying to make work.

Code: Select all

preg_replace('/<input(.*?)id="(.*?)-required" type="checkbox"(.*?)>/','',$Content);
It cant find a match I'm guessing but I am lost as to why though. Any help would be great.
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Regex to Find All Checkboxes

Post by klevis miho »

Show us some code of how the input checkboxes are made of.
Post Reply