Title: Help with incorrectly-written code
Last modified: August 20, 2016

---

# Help with incorrectly-written code

 *  [dfwgreg](https://wordpress.org/support/users/dfwgreg/)
 * (@dfwgreg)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/help-with-incorrectly-written-code/)
 * Hello,
    I have no coding skills and I found a piece of code I was looking for.
   Only problem is that it is not written correctly. I just need someone to correct
   this one line as the code does work when this line is removed.
 * The code in question:
    `$output = preg_match_all("/caption=['"](.*)/", $content,
   $matches);`
 * The error message when executed:
    `Parse error: syntax error, unexpected ']'`
 * Thanks for all the help,
    Gregory S.

Viewing 1 replies (of 1 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/help-with-incorrectly-written-code/#post-2450561)
 * I think what you need is a slash before the double-quote preceding the closing
   bracket, like this:
 *     ```
       $output = preg_match_all("/caption=['\"](.*)/", $content, $matches);
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Help with incorrectly-written code’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/help-with-incorrectly-written-code/#post-2450561)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
