How to include space character in regular expression
In continuation to the previous thread. Can anyone please tell how to include space character is regular expression. I know it was wrong but still tried "! .*" Trying to extract strings that has multiple spaces bewteen 2 strings.
I hate to use this but I am stuck at present with my code.
Thanks in advance
Re: How to include space character in regular expression
" *" will match any number of spaces in Regular Expression.
The split() function does Not use Regular Expression!
split ( string, array [ , field_separators ] );
string A valid string expression.
array The name of the storage array.
field_separators The characters in the string which designate where the string is to be split into fields. Each single character is used as a separator.
The split function divides an input string into fields, using a single character separator. The fields are stored as subscripts of an array, and the number of array elements created is returned. Note that the first element in the array index is numbered 1.
Note: The number of elements in the array equals the result of the split. As in any array, they are sequential integers.
# Your example has the ";" missing after the next line ...
str = "stringa - stringb 0";
# The split() fucntion does Not use RE!
# rc1 = split ( str, strarr, "! *" );
rc1 = split ( str, strarr, " " );
for ( i = 1; i <= rc1; i++)
printf ( "strarr[%s]=[%s]", i, strarr[i] );