Re: Adding/Removing bytes from the beginning of a file
- Posted by ghaberek (admin) Feb 25, 2015
- 1580 views
True, they could have been called put2 and put4 respectively. It is hard to get people to change the names for things though, even before release I lobbied to name the regex functions match rather than find, but nobody would go along with that. Write your own library to wrap the function names that are too long.
This is exactly what I do (rewrite functions with the correct name). Incidentally, the main function in my own RegEx lib (written from scratch but loosely based on a User Contribution) is named match instead of find. It makes sense given that we are more concerned with matching a pattern rather than finding its location.
Spock
It's interesting that you bring this up because I only recently discovered that there even was a "find" function in the regex library. I always use has_match() or is_match() and then matches() or all_matches() to process my regex queries. I'm generally more concerned with using patterns to extract one bit of text from a larger string, for which matches() works much better. YMMV, of course.
regex re_pattern = regex:new( `(.*?)` ) if regex:has_match( re_pattern, my_text ) then sequence matches = regex:matches( re_pattern, my_text ) -- play with matches ;) end if
-Greg