You can achieve what you need by using two steps.
You could use this regex to validate the format:
\^\(\w+(?:\|\w+)*\)\$

Once you validated the right strings you can use a function like this:
$str = "^(100|500|1000|2000|3000)$"; $arr = preg_split ("/\W+/" , $str, -1, PREG_SPLIT_NO_EMPTY); print_r($arr);
Output:
Array ( [0] => 100 [1] => 500 [2] => 1000 [3] => 2000 [4] => 3000 )
Related Posts:
- How is the AND/OR operator represented as in Regular Expressions?
- How to accept space in regex?
- Regex lookahead, lookbehind and atomic groups
- Regex not operator
- Compiler Error “void value not ignored as it ought to be” in C programming [duplicate]
- Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException Error
- What does the regex \S mean in JavaScript?
- How can I validate an email address using a regular expression?
- Different between ./ , ../ , ../../ , ~/ on file path(URL) in asp.net
- Difference between associative entity and associative relationship attribute?
- max value of integer
- Regex: ignore case sensitivity
- How to install apoc for neo4j?
- What is the difference between == and equals() in Java?
- XQuery data and text() function
- Split string on whitespace in Python
- PHP – exit or return which is better?
- How do you copy and paste into Git Bash
- In Typescript, what is the ! (exclamation mark / bang) operator when dereferencing a member?
- How to resolve ‘preflight is invalid (redirect)’ or ‘redirect is not allowed for a preflight request’
- Implement touch using Python?
- How to override equals method in Java
- ldap_bind: Invalid Credentials (49)
- Error compiling CUDA from Command Prompt
- Java – String cannot be converted to int
- Why doesn’t Dijkstra’s algorithm work for negative weight edges?
- How do emulators work and how are they written?
- Regex Explanation ^.*$ [duplicate]
- How to join two tables by multiple columns in SQL?
- Java “params” in method signature?
- what is the diffrence between TCP TAHOE and TCP RENO
- Missing value auth-url required for auth plugin password
- JMS Topic vs Queues
- How to set the authorization header using cURL
- yum error “Cannot retrieve metalink for repository: epel. Please verify its path and try again” updating ContextBroker
- OCaml: Match expression inside another one?
- Error: Local workspace file (‘angular.json’) could not be found
- Cannot join on Memo, OLE, or Hyperlink Object
- Javascript Regular Expression Remove Spaces
- Very basic inheritance: error: expected class-name before ‘{’ token
- Why doesn’t “System.out.println” work in Android?
- Regular expression to match a word or its prefix
- What is the `data-target` attribute in Bootstrap 3?
- Regular expression for a string that does not start with a sequence
- PostgreSQL: Query has no destination for result data
- server error:405 – HTTP verb used to access this page is not allowed
- Subtract 1 day with PHP
- How to extract a substring using regex
- Regular expression to stop at first match
- How do you use replace in Spyder?
- How to use regex in String.contains() method in Java
- /bb|[^b]{2}/ how does it work?
- Regular expression to remove HTML tags from a string
- Case insensitive regular expression without re.compile?
- Eclipse IDE – Error: Build path specifies execution environment Java SE 1.7
- Operator Overloading C++; too many parameters for << operation
- Regex to validate date formats dd/mm/YYYY, dd-mm-YYYY, dd.mm.YYYY, dd mmm YYYY, dd-mmm-YYYY, dd/mmm/YYYY, dd.mmm.YYYY with Leap Year Support
- What are the double colons (::) in R?
- Visual Studio 2019 – error MSB8020: The build tools for Visual Studio 2013 cannot be found
- How to not-analyze in ElasticSearch?
- Set size of WordPress thumbnail post
- Efficient Taxonomy Intersection
- Regex in add_rewrite_tag not accepting OR operators?
- Making extra parameters optional
- Remove all table widths from editor content
- Using stackexchange markup in WordPress (plugin?)
- htaccess redirect – replace special character
- How can I reduce the number of rewrite rules?
- Can't get on my own web page
- Home screen width Stretch [closed]
- Create Metaboxes dynamically in admin for Pages
- Strange behaviour of REGEX in a WordPress filter (trying to suppress emtpy paragraphs)
- How to add featured image with mutiple images
- How to fix old embeded iframes with WP-CLI search-replace
- Strip Twitter Username from Profile Field with URL and Save to New Profile Field
- How do I deal with a compromised server?
- Something is burning in the server room; how can I quickly identify what it is?
- Finding out what user Apache is running as?
- Do systemd unit files have to be reloaded when modified?
- What is a glue record?
- How do I convert a .cer certificate to .pem?
- Run Oracle SQL script and exit from sqlplus.exe via command prompt
- Show full process name in top
- How do you do load testing and capacity planning for web sites?
- What is a good SSH server to use on Windows? [closed]
- In systemd, what’s the difference between After= and Requires=?
- Windows Server restart / shutdown history
- How do I set the global PATH environment variable on OS X?
- nmap find all alive hostnames and IPs in LAN
- Should CNAME Be Used For Subdomains?
- How do I create user accounts from the Terminal in Mac OS X 10.5?
- How to get a .pem file from ssh key pair?
- How to inspect remote SMTP server’s TLS certificate?
- Choosing between meaningful and meaningless hostnames [closed]
- logrotating files in a directories and its subdirectories
- Multiple TXT fields for same subdomain
- How to restart Nginx on Mac OS X?
- Do SPF Records For Primary Domain apply to subdomains?
- Why is the response on localhost so slow?
- apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName