Excel Regex SEARCH Function

Masum Mahdy

New Member
Joined
Jul 17, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi good people! I need to create a RegEx function that will work the same way Excel SEARCH or FIND function works.
For example, the SEARCH function returns the position of a part of text within a string.
I want a RegEx SEARCH function that will match a pattern and return the location of the pattern within a string.
Anybody can help, please?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I hope this image will make my query clearer.
 

Attachments

  • 186.png
    186.png
    15.8 KB · Views: 14
Upvote 0
Hii

Still not clear, can you please explain with some examples.
 
Upvote 0
Hii

Still not clear, can you please explain with some examples.
Hi Sufiyan.
If I use the SEARCH function, it will detect exactly the input substring. But I need to return the position of a substring within the main string where the substring has a certain pattern, in order that if I change the substring, but keep the pattern the same as before, my desired RegEx function will consider it the same. To SEARCH function, AAA means AAA, and AAA is not the same as CCC. But my desired VBA RegEx function will consider AAA and CCC the same, because they have the same pattern, and this function will work just as the original SEARCH function does.
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Excel REGEX SEARCH Function
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,214,957
Messages
6,122,466
Members
449,086
Latest member
kwindels

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top