src/HumRegex.cpp
int HumRegex::search(const string& input, const string& exp) {
	m_regex = regex(exp, m_regexflags);
	bool result = regex_search(input, m_matches, m_regex, m_searchflags);
	if (!result) {
		return 0;
	} else if (m_matches.size() < 1) {
		return 0;
	} else {
		// return the char+1 position of the first match
		return (int)m_matches.position(0) + 1;
	}
}
//////////////////////////////
//
// HumRegex::search -- Search for the regular expression in the
//    input string.  Returns the character position + 1 of the first match if any found.
//    Search results can be accessed with .getSubmatchCount() and .getSubmatch(index).
//
//    Warning: a temporary string cannot be used as input to the search function
//    if you want to call getMatch() later.  If you do a memory leak will occur.
//    If you have a temporary string, first save it to a variable which remains
//    in scope while accesssing a match with getMatch().
//
:search -- Search for the regular expression in the
input string.  Returns the character position + 1 of the first match if any found.
Search results can be accessed with .getSubmatchCount() and .getSubmatch(index).

a temporary string cannot be used as input to the search function
if you want to call getMatch() later.  If you do a memory leak will occur.
If you have a temporary string, first save it to a variable which remains
in scope while accesssing a match with getMatch().
: search -- Search for the regular expression in the input string . Returns the character position + 1 of the first match if any found . Search results can be accessed with . getSubmatchCount () and . getSubmatch ( index ) . a temporary string cannot be used as input to the search function if you want to call getMatch () later . If you do a memory leak will occur . If you have a temporary string first save it to a variable which remains in scope while accesssing a match with getMatch () .
int HumRegex::search(const string& input, const string& exp) {
	m_regex = regex(exp, m_regexflags);
	bool result = regex_search(input, m_matches, m_regex, m_searchflags);
	if (!result) {
		return 0;
	} else if (m_matches.size() < 1) {
		return 0;
	} else {
		return (int)m_matches.position(0) + 1;
	}
}
int HumRegex :: search ( const string & input , const string & exp ) { m_regex = regex ( exp , m_regexflags ) ; bool result = regex_search ( input , m_matches , m_regex , m_searchflags ) ; if ( ! result ) { return 0 ; } else if ( m_matches . size ( ) < 1 ) { return 0 ; } else { return ( int ) m_matches . position ( 0 ) + 1 ; } }
HumRegex::search -- Search for the regular expression in the
input string.
HumRegex :: search -- Search for the regular expression in the input string .
// return the char+1 position of the first match