From: Abhishek on 26 Jul 2010 05:02 Hi I am doing Out2 = regexp(TL5{3},'\w*','match'); where >> TL5{3} ans = '3000,3e-12' which returns me Out2 = '3000' '3e' '12' but i want Out2= '3000' '3e-12' Please tell me the command ... thank you....
From: Oleg Komarov on 26 Jul 2010 05:14 "Abhishek " <abhi14jan(a)yahoo.com> wrote in message <i2jiud$n6b$1(a)fred.mathworks.com>... > Hi > I am doing > Out2 = regexp(TL5{3},'\w*','match'); > where > >> TL5{3} > ans = > '3000,3e-12' > which returns me > Out2 = > > '3000' '3e' '12' > but i want Out2= > '3000' '3e-12' > Please tell me the command ... > thank you.... In regular expressions: \w --> Any alphabetic, numeric, or underscore character. For English character sets, this is equivalent to [a-zA-Z_0-9]. Modify \w into '[a-zA-Z-0-9]*' to include "-". Oleg
From: Abhishek on 26 Jul 2010 05:40 thanks a lot
From: Walter Roberson on 26 Jul 2010 09:55 Oleg Komarov wrote: > "Abhishek " <abhi14jan(a)yahoo.com> wrote in message > <i2jiud$n6b$1(a)fred.mathworks.com>... >> Hi I am doing Out2 = regexp(TL5{3},'\w*','match'); >> where >> TL5{3} >> ans = >> '3000,3e-12' >> which returns me Out2 = >> '3000' '3e' '12' >> but i want Out2= >> '3000' '3e-12' >> Please tell me the command ... >> thank you.... > > In regular expressions: \w --> Any alphabetic, numeric, or underscore > character. For English character sets, this is equivalent to [a-zA-Z_0-9]. > > Modify \w into '[a-zA-Z-0-9]*' to include "-". You would need to use [-a-zA-Z_0-9] to extend to include "-". "-" is magic in where it has to go because of its role in indicating a range. Also, [a-zA-Z_0-9] is not exactly the same as \w because \w includes alphabetic characters according to the current character set setting. I would suggest that instead of using '\w*' and 'match', that the OP consider using ',' and 'split'
From: Oleg Komarov on 26 Jul 2010 10:23 Walter Roberson <roberson(a)hushmail.com> wrote in message <Wsg3o.49156$Ls1.612(a)newsfe11.iad>... > Oleg Komarov wrote: > > "Abhishek " <abhi14jan(a)yahoo.com> wrote in message > > <i2jiud$n6b$1(a)fred.mathworks.com>... > >> Hi I am doing Out2 = regexp(TL5{3},'\w*','match'); > >> where >> TL5{3} > >> ans = > >> '3000,3e-12' > >> which returns me Out2 = > >> '3000' '3e' '12' > >> but i want Out2= > >> '3000' '3e-12' > >> Please tell me the command ... > >> thank you.... > > > > In regular expressions: \w --> Any alphabetic, numeric, or underscore > > character. For English character sets, this is equivalent to [a-zA-Z_0-9]. > > > > Modify \w into '[a-zA-Z-0-9]*' to include "-". > > You would need to use [-a-zA-Z_0-9] to extend to include "-". "-" is > magic in where it has to go because of its role in indicating a range. > > Also, [a-zA-Z_0-9] is not exactly the same as \w because \w includes > alphabetic characters according to the current character set setting. > > I would suggest that instead of using '\w*' and 'match', that the OP > consider using ',' and 'split' Yes, definitely more readable: Out = regexp(TL5{3}, ',' , 'split'); Oleg
|
Pages: 1 Prev: one-sided 2D inverse fourier transform Next: 64bit integer |