Why is there a difference in using regexp in MATLAB and online regexp tools like regex101, regexr etc
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a certain expression used to filter details from a large data file.
substation_nodes = regexp(text, '(<node.*?\">(.|\n)*?)(?=<\/node>)','match');
This behaves differently on on-line tools like regex101.com regexr.com (which gives me the required answer) but not the same way in MATLAB (does not give me the required answer).
Please check this link below for the exact problem. I did not get an answer for this question after waiting for more than a week and so I asked this question again http://de.mathworks.com/matlabcentral/answers/251142-how-to-get-multiline-matches-using-regular-expressions-regexp
I would be grateful for anyone who can help me out here.
Thanks in advance
2 commentaires
dpb
le 5 Nov 2015
I "know nuthink!" useful at this level of regular expressions to have any hope of solving your actual problem but the answer to the question in the subject is "because". :)
To amplify a little, TMW supplies a particular implementation/level of regexp with Matlab and that is particular to their own internal branch of whatever source repository they chose initially. Hence, there is no direct correlation between the Matlab builtin and any other implementation of which there are, as your text above shows, several.
I'd guess the fastest path to resolve you issue, may be to pass the command to the OS and use the external package instead.
But, there are some regexp whizards around, maybe one will see the query this time 'round and have more useful direct info.
Walter Roberson
le 5 Nov 2015
(.|\n) in MATLAB is the same as (.) unless you have used the option 'dotexceptnewline' .
Réponses (0)
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!