<p>Hi Guys I'm very new to regex, can you help me with this.</p>

<p>I have a string like this <code>"&lt;input attribute='value' &gt;"</code> where <code>attribute='value'</code> could be anything and  I want to get do a <code>preg_replace</code> to get just <code>&lt;input /&gt;</code></p>

<p>How do I specify a wildcard to replace any number of any characters in a srting?</p>

<p>like this? <code>preg_replace("/&lt;input.*&gt;/",$replacement,$string);</code></p>

<p>Many thanks</p>

What you have:
```
```
.*
```
```
will match "any character, and as many as possible.
what you
mean
is
```
```
[^>]+
```
```
which translates to "any character, thats not a ">", and there must be at least one
or altertaively,
```
```
.*?
```
```
which means
"any character, but only enough to make this rule work"
BUT DONT
Parsing HTML with regexps is
Bad
use any of the existing html parsers, DOM librarys, anything, Just NOT NAïVE  REGEX
For example:
```
```
<foo attr=">">
```
```
Will get grabbed wrongly by regex as
```
```
'<foo attr=" ' with following text of '">'
```
```
Which will lead you to this regex:
```
```
`<[a-zA-Z]+( [a-zA-Z]+=['"][^"']['"])*)>  etc etc
```
```
at which point you'll discover this lovely gem:
```
```
<foo attr="'>\'\"">
```
```
and your head will explode.
( the syntax highlighter verifies my point, and incorrectly matches thinking i've ended the tag. )