Can someone give me an example of how you do pattern matching in a string? For instance, if there's more than one decimal point in a string, or if there is a + or - that's embedded in the string / not the leading character of the string?
Thanks!
Can someone give me an example of how you do pattern matching in a string? For instance, if there's more than one decimal point in a string, or if there is a + or - that's embedded in the string / not the leading character of the string?
Thanks!
regexp can be used to deal with things like this.. but i don't know how to use it
you could break the string down into fields, maybe one type for all numbers, another type for a decimal or a plus.. and then use a simple test of the sequence of fields (maybe driven by a table) to figure out which format the string is in. (to build the fields, you might use a linked list and loop through the string, adding a new field after processing all the data that belongs in a single field..)
.sect signature
There are two major pattern matching algoritims:
Boyer-Moore and KMP- Knuth Morris Pratt
check them out
Mr. C: Author and Instructor
Does C support Regular Expressions?
Not in the standard. But some compilers have things like thisOriginally posted by _Cl0wn_
Does C support Regular Expressions?
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]