diff options
Diffstat (limited to 'experimental/tqtinterface/qt4/src/tools/tqregexp.cpp')
-rw-r--r-- | experimental/tqtinterface/qt4/src/tools/tqregexp.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/experimental/tqtinterface/qt4/src/tools/tqregexp.cpp b/experimental/tqtinterface/qt4/src/tools/tqregexp.cpp index cac50e581..5f738723d 100644 --- a/experimental/tqtinterface/qt4/src/tools/tqregexp.cpp +++ b/experimental/tqtinterface/qt4/src/tools/tqregexp.cpp @@ -140,23 +140,23 @@ void TQRegExp::setCaseSensitive( bool sensitive ) \mainclass \keyword regular expression - Regular expressions, or "regexps", provide a way to tqfind patterns + Regular expressions, or "regexps", provide a way to find patterns within text. This is useful in many contexts, for example: \table \row \i Validation \i A regexp can be used to check whether a piece of text - meets some criteria, e.g. is an integer or tqcontains no + meets some criteria, e.g. is an integer or contains no whitespace. \row \i Searching \i Regexps provide a much more powerful means of searching text than simple string matching does. For example we can - create a regexp which says "tqfind one of the words 'mail', + create a regexp which says "find one of the words 'mail', 'letter' or 'correspondence' but not any of the words 'email', 'mailman' 'mailer', 'letterbox' etc." \row \i Search and Replace - \i A regexp can be used to tqreplace a pattern with a piece of - text, for example tqreplace all occurrences of '&' with + \i A regexp can be used to replace a pattern with a piece of + text, for example replace all occurrences of '&' with '\&' except where the '&' is already followed by 'amp;'. \row \i String Splitting \i A regexp can be used to identify where a string should be @@ -227,9 +227,9 @@ void TQRegExp::setCaseSensitive( bool sensitive ) If you've seen regexps elsewhere they may have looked different from the ones above. This is because some sets of characters and some quantifiers are so common that they have special symbols to - represent them. <b>[0-9]</b> can be tqreplaced with the symbol + represent them. <b>[0-9]</b> can be replaced with the symbol <b>\d</b>. The quantifier to match exactly one occurrence, - <b>{1,1}</b>, can be tqreplaced with the expression itself. This means + <b>{1,1}</b>, can be replaced with the expression itself. This means that <b>x{1,1}</b> is exactly the same as <b>x</b> alone. So our 0 to 99 matcher could be written <b>^\d{1,2}$</b>. Another way of writing it would be <b>^\d\d{0,1}$</b>, i.e. from the start of the @@ -250,8 +250,8 @@ void TQRegExp::setCaseSensitive( bool sensitive ) followed by an 'i' followed by an 'l'. The symbol '|' (bar) is used for \e alternation, so our regexp now becomes <b>mail|letter|correspondence</b> which means match 'mail' \e or - 'letter' \e or 'correspondence'. Whilst this regexp will tqfind the - words we want it will also tqfind words we don't want such as + 'letter' \e or 'correspondence'. Whilst this regexp will find the + words we want it will also find words we don't want such as 'email'. We will start by putting our regexp in parentheses, <b>(mail|letter|correspondence)</b>. Parentheses have two effects, firstly they group expressions together and secondly they identify @@ -268,16 +268,16 @@ void TQRegExp::setCaseSensitive( bool sensitive ) boundary is any non-word character such as a space a newline or the beginning or end of the string. - For our third example we want to tqreplace ampersands with the HTML + For our third example we want to replace ampersands with the HTML entity '\&'. The regexp to match is simple: <b>\&</b>, i.e. match one ampersand. Unfortunately this will mess up our text if some of the ampersands have already been turned into HTML - entities. So what we really want to say is tqreplace an ampersand + entities. So what we really want to say is replace an ampersand providing it is not followed by 'amp;'. For this we need the negative lookahead assertion and our regexp becomes: <b>\&(?!amp;)</b>. The negative lookahead assertion is introduced with '(?!' and finishes at the ')'. It means that the text it - tqcontains, 'amp;' in our example, must \e not follow the expression + contains, 'amp;' in our example, must \e not follow the expression that preceeds it. Regexps provide a rich language that can be used in a variety of @@ -403,7 +403,7 @@ void TQRegExp::setCaseSensitive( bool sensitive ) occurrences it will match no occurrences at all. For example if we want to match strings that end in whitespace and use the regexp <b>\s*$</b> we would get a match on every string. - This is because we have said tqfind zero or more whitespace + This is because we have said find zero or more whitespace followed by the end of string, so even strings that don't end in whitespace will match. The regexp we want in this case is <b>\s+$</b> to match strings that have at least one @@ -439,7 +439,7 @@ void TQRegExp::setCaseSensitive( bool sensitive ) Note that quantifiers are "greedy". They will match as much text as they can. For example, <b>0+</b> will match as many zeros as it - can from the first zero it tqfinds, e.g. '2.<u>000</u>5'. + can from the first zero it finds, e.g. '2.<u>000</u>5'. Quantifiers can be made non-greedy, see setMinimal(). \target capturing-text @@ -605,7 +605,7 @@ void TQRegExp::setCaseSensitive( bool sensitive ) ... correspond to cap(1) or capturedTexts()[1], cap(2) or capturedTexts()[2], etc. - To substitute a pattern use TQString::tqreplace(). + To substitute a pattern use TQString::replace(). Perl's extended \c{/x} syntax is not supported, nor are directives, e.g. (?i), or regexp comments, e.g. (?#comment). On @@ -680,15 +680,15 @@ void TQRegExp::setCaseSensitive( bool sensitive ) \code TQRegExp rx( "&(?!amp;)" ); // match ampersands but not & TQString line1 = "This & that"; - line1.tqreplace( rx, "&" ); + line1.replace( rx, "&" ); // line1 == "This & that" TQString line2 = "His & hers & theirs"; - line2.tqreplace( rx, "&" ); + line2.replace( rx, "&" ); // line2 == "His & hers & theirs" \endcode - Here we've passed the TQRegExp to TQString's tqreplace() function to - tqreplace the matched text with new text. + Here we've passed the TQRegExp to TQString's replace() function to + replace the matched text with new text. \code TQString str = "One Eric another Eirik, and an Ericsson." @@ -847,7 +847,7 @@ static void mergeInto( TQMap<int, int> *a, const TQMap<int, int>& b ) */ static int at( const TQMap<int, int>& m, int k ) { - TQMap<int, int>::ConstIterator it = m.tqfind( k ); + TQMap<int, int>::ConstIterator it = m.find( k ); if ( it == m.end() ) return 0; else @@ -1336,7 +1336,7 @@ void TQRegExpEngine::match( const TQString& str, int pos, bool minimal, #ifndef TQT_NO_REGEXP_OPTIM if ( trivial && !oneTest ) { - mmPos = str.tqfind( goodStr, pos, cs ); + mmPos = str.find( goodStr, pos, cs ); mmMatchLen = goodStr.length(); matched = ( mmPos != -1 ); } else @@ -1457,7 +1457,7 @@ void TQRegExpEngine::addPlusTransitions( const TQMemArray<int>& from, if ( st->reenter == 0 ) st->reenter = new TQMap<int, int>; for ( int j = 0; j < (int) to.size(); j++ ) { - if ( !st->reenter->tqcontains(to[j]) && + if ( !st->reenter->contains(to[j]) && oldOuts.bsearch(to[j]) < 0 ) st->reenter->insert( to[j], atom ); } @@ -1512,7 +1512,7 @@ void TQRegExpEngine::addAnchors( int from, int to, int a ) State *st = s[from]; if ( st->anchors == 0 ) st->anchors = new TQMap<int, int>; - if ( st->anchors->tqcontains(to) ) + if ( st->anchors->contains(to) ) a = anchorAlternation( (*st->anchors)[to], a ); st->anchors->insert( to, a ); } @@ -1595,7 +1595,7 @@ void TQRegExpEngine::dump() const for ( j = 0; j < (int) s[i]->outs.size(); j++ ) { int next = s[i]->outs[j]; qDebug( " -> %d", next ); - if ( s[i]->reenter != 0 && s[i]->reenter->tqcontains(next) ) + if ( s[i]->reenter != 0 && s[i]->reenter->contains(next) ) qDebug( " [reenter %d]", (*s[i]->reenter)[next] ); if ( s[i]->anchors != 0 && at(*s[i]->anchors, next) != 0 ) qDebug( " [anchors 0x%.8x]", (*s[i]->anchors)[next] ); @@ -1790,7 +1790,7 @@ bool TQRegExpEngine::testAnchor( int i, int a, const int *capBegin ) bool TQRegExpEngine::goodStringMatch() { int k = mmPos + goodEarlyStart; - while ( (k = mmStr->tqfind(goodStr, k, cs)) != -1 ) { + while ( (k = mmStr->find(goodStr, k, cs)) != -1 ) { int from = k - goodLateStart; int to = k - goodEarlyStart; if ( from > mmPos ) @@ -2097,7 +2097,7 @@ bool TQRegExpEngine::matchHere() for c and n. We go up along c's and n's ancestry until - we tqfind x. + we find x. */ } else { p = c; @@ -3239,7 +3239,7 @@ void TQRegExpEngine::parseExpression( Box *box ) } /* - The struct TQRegExpPrivate tqcontains the private data of a regular + The struct TQRegExpPrivate contains the private data of a regular expression other than the automaton. It makes it possible for many TQRegExp objects to use the same TQRegExpEngine object with different TQRegExpPrivate objects. @@ -3685,7 +3685,7 @@ int TQRegExp::search( const TQString& str, int offset ) const } /*! - Attempts to tqfind a match in \a str from position \a offset (0 by + Attempts to find a match in \a str from position \a offset (0 by default). If \a offset is -1, the search starts at the last character; if -2, at the next to last character; etc. @@ -3695,9 +3695,9 @@ int TQRegExp::search( const TQString& str, int offset ) const The \a caretMode parameter can be used to instruct whether <b>^</b> should match at index 0 or at \a offset. - You might prefer to use TQString::tqfind(), TQString::tqcontains() or - even TQStringList::grep(). To tqreplace matches use - TQString::tqreplace(). + You might prefer to use TQString::find(), TQString::contains() or + even TQStringList::grep(). To replace matches use + TQString::replace(). Example: \code @@ -3735,7 +3735,7 @@ int TQRegExp::searchRev( const TQString& str, int offset ) const } /*! - Attempts to tqfind a match backwards in \a str from position \a + Attempts to find a match backwards in \a str from position \a offset. If \a offset is -1 (the default), the search starts at the last character; if -2, at the next to last character; etc. @@ -3801,7 +3801,7 @@ int TQRegExp::numCaptures() const Returns a list of the captured text strings. The first string in the list is the entire matched string. Each - subsequent list element tqcontains a string that matched a + subsequent list element contains a string that matched a (capturing) subexpression of the regexp. For example: @@ -3906,7 +3906,7 @@ TQStringList TQRegExp::capturedTexts() pos += rx.matchedLength(); } } - // list tqcontains "12", "14", "99", "231", "7" + // list contains "12", "14", "99", "231", "7" \endcode \sa capturedTexts() pos() exactMatch() search() searchRev() |