Title: get_shortcode_atts_regex
Published: December 9, 2015
Last modified: April 28, 2025

---

# get_shortcode_atts_regex(): string

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/get_shortcode_atts_regex/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_shortcode_atts_regex/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_shortcode_atts_regex/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_shortcode_atts_regex/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/get_shortcode_atts_regex/?output_format=md#wp--skip-link--target)

Retrieves the shortcode attributes regex.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_shortcode_atts_regex/?output_format=md#return)󠁿

 string The shortcode attribute regular expression.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_shortcode_atts_regex/?output_format=md#source)󠁿

    ```php
    function get_shortcode_atts_regex() {
    	return '/([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*\'([^\']*)\'(?:\s|$)|([\w-]+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|\'([^\']*)\'(?:\s|$)|(\S+)(?:\s|$)/';
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/shortcodes.php#L593)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/shortcodes.php#L593-L595)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_shortcode_atts_regex/?output_format=md#related)󠁿

| Used by | Description | 
| [shortcode_parse_atts()](https://developer.wordpress.org/reference/functions/shortcode_parse_atts/)`wp-includes/shortcodes.php` |

Retrieves all attributes from the shortcodes tag.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_shortcode_atts_regex/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_shortcode_atts_regex%2F)
before being able to contribute a note or feedback.