Regex for string match
Show older comments
I have a huge string array 1*50000 length like below:
Stock_field1_img
Sys_tim_valt98.qaf.rat.app.gui
Enable1.HSB_setblcondition.Enable_logic.ui
P_k12.delay.init_func_delay_update.Sys
#fat_11ks.ergaa.ths.dell
$thispt.dynmem11.ide.gra
.....
.....
I am looking for a regex, which can search this array based on "user input". For ex,
if user gives st* then it should get all the strings starting with "st" ,
if user gives *st then it should get all strings ending with "st",
if user gives *st* then it should get all strings which has st in between start and end,
user can also give *st*app.*sys* then it should list all combinations which has strings with st in between, followed by app. in between and followed by sys in between.
I tried multiple combos like below and also other combinations
expression = '\w* + signal + \w*';
a = regexp(str_array, ,'match','ignorecase');
but doesn't work as intended, could someone help with this.
Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!