Text mining. Using Regular Expression
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Afeez Oyedeji
le 5 Jan 2020
Réponse apportée : Max Murphy
le 5 Jan 2020
hi, please i need someone to explain this paritcular regular expression to me. What type of string can i use in the expression as i want the outpuf to be split? Thanks in advance.
regexpi ('string','\x','split')
0 commentaires
Réponse acceptée
Max Murphy
le 5 Jan 2020
It depends on how you would like to split the input. As entered, your expression evaluates to
>> test = regexpi('string','\x','split')
test =
cell
'string'
The metacharacter '\x' is used if you have the hexadecimal value of a desired character that you want to match. For all the metacharacters, see:
If you wanted to split an arbitrary string anywhere that it had a certain hexadecimal character, then you would have to specify the hexadecimal value after '\x'. For example
% ASCII hex value for character for 'i' is 69
>> test = regexpi('string','\x69','split')
test =
1×2 cell array
'str' 'ng'
To recover the hex value for a given character, you could use dec2hex
>> dec2hex('i')
ans =
'69'
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!