+ Reply to Thread
Results 1 to 4 of 4

Multiple patterns in one RegEx function

  1. #1
    Forum Contributor
    Join Date
    10-06-2012
    Location
    Basel, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    157

    Multiple patterns in one RegEx function

    Hello
    I would like to include 2 patterns in one function, e.g.

    Please Login or Register  to view this content.
    What's the best way to do it?
    Many thanks
    Nic
    Last edited by Niclal; 06-29-2022 at 03:21 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,719

    Re: Multiple patterns in one RegEx function

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Multiple patterns in one RegEx function

    You must use code tags when posting code - please edit your original post and do this. For your problem, you can use the RegEx "or" operator of pipe:

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,719

    Re: Multiple patterns in one RegEx function

    @WideBoyDixon I have not tested this but wouldn't you have to put parens around each entire expression to the left and right of the pipe?

    Please Login or Register  to view this content.
    Otherwise I think the pipe will just apply to the expressions immediately to the left and right

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Instr function withing Regex
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-03-2019, 04:21 AM
  2. [SOLVED] Regex exact match function
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 32
    Last Post: 05-03-2019, 02:40 AM
  3. [SOLVED] Instr with RegEx - Runtime error 5017 (RegEx Code provided)
    By dluhut in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-28-2018, 05:02 PM
  4. help with regex function for extract numbers out
    By Pancho3 in forum Excel General
    Replies: 4
    Last Post: 09-21-2018, 02:56 PM
  5. [SOLVED] help with a function using Regex
    By Pancho3 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-24-2016, 09:22 PM
  6. Passing a RegEx to a function
    By amphinomos in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-31-2014, 06:12 AM
  7. RegEx Replacement patterns
    By CodeSponge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-05-2005, 04:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1