I’m going to assume you want to build a the regex dynamically to contain other words than part1 and part2, and that you want order not to matter. If so you can use something like this:
((^|, )(part1|part2|part3))+$
Positive matches:
part1 part2, part1 part1, part2, part3
Negative matches:
part1, //with and without trailing spaces. part3, part2, otherpart1
Related Posts:
- How to accept space in regex?
- Regex how to match an optional character
- Regex lookahead, lookbehind and atomic groups
- Regex how to match an optional character
- What are the double colons (::) in R?
- Regex multiple match substring
- How do I copy folder with files to another folder in Unix/Linux? [closed]
- What does \’.- mean in a Regular Expression
- How do I fix a “Expected Primary-expression before ‘)’ token” error?
- How can I exclude one word with grep?
- Matching a space in regex
- What is archive mode in rsync?
- Turn off pager for psql’s interactive output
- What does operator “dot” (.) mean?
- Regex: ignore case sensitivity
- What does “xmlns” in XML mean?
- How do I get my C# program to sleep for 50 msec?
- What is an idiomatic way of representing enums in Go?
- Why the range of int is -32768 to 32767?
- syntaxerror: “unexpected character after line continuation character in python” math
- Regular expression to match standard 10 digit phone number
- How to update multiple columns in single update statement in DB2
- what does the __file__ variable mean/do?
- What does the power operator (**) in python translate into?
- what is the meaning of == sign?
- How to validate an email address in PHP
- Error in .External.graphics R
- RegEx Ignore Case
- Regular expression to match standard 10 digit phone number
- How to validate an email address in JavaScript
- Center Plot title in ggplot2
- Regular expression for exact match of a string
- what is the difference between OLE DB and ODBC data sources?
- How to use vmImage on pipeline using Azure DevOps Server?
- git add . -> still “nothing to commit” with new files
- git submodule add error: does not have a commit checked out
- “The certificate chain was issued by an authority that is not trusted” when connecting DB in VM Role from Azure website
- What’s the complete range for Chinese characters in Unicode?
- Is there an operation for not less than or not greater than in python?
- What does =~ do in Perl?
- Resource interpreted as stylesheet but transferred with MIME type text/html (seems not related with web server)
- Background color for Tk in Python
- how to uninstall MinGW and make cygwin ‘make’ as deafult make program with gcc 3.8.1
- Android – Package Name convention
- How to execute an oracle stored procedure?
- How do I time a method’s execution in Java?
- Regex: Remove lines containing “help”, etc
- -bash: export: `=’: not a valid identifier
- Error “The goal you specified requires a project to execute but there is no POM in this directory” after executing maven command
- I want to remove double quotes from a String
- Error in glm() in R
- What is a good Hash Function?
- Excel Filters – show only relevant values in the filter
- How to transparent Unity3D custom shader?
- Javascript: operator overloading
- Converting string to integer VB.NET
- How to ignore whitespace in a regular expression subject string?
- Remove node_modules from git in vscode
- How do you change session timeout in IIS 8.5?
- Differentiate between function overloading and function overriding
- Using regex to match any character except =
- Regex that matches integers in between whitespace or start/end of string only
- How to print variable in sml?
- What’s the difference between “mod” and “remainder”?
- Python a &= b meaning?
- How to disable an Android button?
- How to set initial value and auto increment in MySQL?
- Chrome Broweser: csi.gstatic.com keeps loading
- How do you convert an entire directory with ffmpeg?
- Remove punctuation from string with Regex
- What is the proof of of (N–1) + (N–2) + (N–3) + … + 1= N*(N–1)/2
- Nested Shortcode Detection
- How to catch images with blank dimensions?
- Merge posts plugin? [closed]
- WordPress returns 404 on custom rewrite rule conflict in parameters
- get attributes/part of the gallery shortcode
- Getting results from wp_oembed_add_provider
- Register Embed Handler for Padlet.com
- What is the structure of the “Featured Image” field in the DB?
- How to make search include data from wp_postmeta?
- How to set up redirects for category paginated pages after adding /category/ to permalink
- Compare meta_query with a Regular Expression and do a less-than operation on it
- Grab WordPress Salt Data From URL
- How can I prevent the WordPress Importer from munging double-newline paragraph breaks to a single newline?
- How to filter url on post submission?
- Slow WP Site, theme.php not caching? Up to 25 second load time! [closed]
- Testing a Form’s Zipcode Field with Regular Expressions to Determine WordPress Page Behaviour
- A Compare And Distinction Essay Define To Beat Writer’s Block
- 27 Outstanding Faculty Essay Examples
- The Way To Write An Essay Outline In Four Steps
- How to hide subfolder of static pages in WordPress using htaccess
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- RegExp to EXCLUDE strip HTML (FOR SOMME) comments
- post->post_content filter
- How to strip/remove all blank spaces at the beginning/end of a search string
- Regex for pdf’s – Old .asp Site folder structure to new WordPress Media Folder(s)
- Use Regex Redirection via htsaccess for RSS Feeds WordPress
- What is a Pem file and how does it differ from other OpenSSL Generated Key File Formats?
- How to set environment variable in systemd service?
- Symlink not updating as expected when using an absolute with relative path