* void
* MyClass:RegularExpressionSample(void)
* {
- * bool ret = false;
- *
* String pattern(L"the quick brown fox");
* String text(L"What do you know about the quick brown fox?");
- * String out;
*
* RegularExpression regex;
* regex.Construct(pattern, REGEX_CASELESS);
*
- * ret = regex.Match(text, false); // This returns true value
+ * bool ret = regex.Match(text, false); // This returns true value
+ * ...
* }
*
* @endcode
* The following example demonstrates how to use the %Construct() method.
* @code
*
- * bool ret = false;
- *
* String pattern(L"^CRUEL$");
* String text(L"Hello\ncruel\nworld");
*
* RegularExpression regex;
* regex.Construct(pattern, REGEX_CASELESS | REGEX_MULTI_LINE);
- * ret = regex.Match(text, false); // This returns true value
+ * bool ret = regex.Match(text, false); // This returns true value
+ * ...
*
* @endcode
*/
* else @c false
* @param[in] text The text to match
* @param[in] fullMatch Set to @c true to match exactly, @n
- * else @c false to match any substring of the text
+ * else @c false to match any substring of the text
* @param[out] pMatchedString A list of the matched string instances @n
- The count of the matched items is acquired from IList::GetCount() and
+ * The count of the matched items is acquired from IList::GetCount() and
* the maximum count of the items is @c 16.
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance has not been constructed as yet.
* @exception E_INVALID_ARG The length of the specified @c text parameter is @c 0.
- * @remarks The specific error code can be accessed using the GetLastResult() method.
- * @remarks If the grouping subpatterns are used in a pattern,
- * the @c pMatchedString list will contain the grouping data. @n
+ * @remarks
+ * - The specific error code can be accessed using the GetLastResult() method.
+ * - If the grouping subpatterns are used in a pattern,
+ * the @c pMatchedString list will contain the grouping data. @n
* For example, if the pattern has two grouping subpatterns,
- * there will be three data sets in the @c pMatchedString list. @n
+ * there will be three data sets in the @c pMatchedString list. @n
* The first data set will be a full grouping data and the second
- * and the third data sets will contain individual grouping data.
+ * and the third data sets will contain individual grouping data.
+ * - Because this method returns a new instance through an out-parameter @c pMatchedString,
+ * the caller needs to delete it after use. @n
+ * Setting the element deleter of @c pMatchedString to SingleObjectDeleter is recommended.
*
* The following example demonstrates how to use the %Match() method.
*
* @code
*
- * bool ret = false;
- *
* String pattern(L"(\\d\\d)-(\\d\\d)-(\\d\\d\\d\\d)");
* String text(L"04-12-1979");
- * String out;
*
* RegularExpression regex;
* regex.Construct(pattern);
*
- * ArrayList list;
+ * ArrayList list(SingleObjectDeleter);
* list.Construct();
*
* // Match
- * ret = regex.Match(text, true, &list); // The list will contain four string instances
+ * bool ret = regex.Match(text, true, &list); // The list will contain four string instances
*
- * out = *(String *)list.GetAt(0); // L"04-12-1979"
- * out = *(String *)list.GetAt(1); // L"04"
- * out = *(String *)list.GetAt(2); // L"12"
- * out = *(String *)list.GetAt(3); // L"1979"
+ * String out = *(dynamic_cast< String* >(list.GetAt(0))); // L"04-12-1979"
+ * out = *(dynamic_cast< String* >(list.GetAt(1))); // L"04"
+ * out = *(dynamic_cast< String* >(list.GetAt(2))); // L"12"
+ * out = *(dynamic_cast< String* >(list.GetAt(3))); // L"1979"
*
- * list.RemoveAll(true);
* @endcode
*/
bool Match(const Tizen::Base::String& text, bool fullMatch, Tizen::Base::Collection::IList* pMatchedString = null) const;
* there will be three data sets in the @c pMatchedString list. @n
* The first data set will be a full grouping data and the second
* and the third data sets will contain individual grouping data.
-
*
* The following example demonstrates how to use the %Consume() method.
* @code
*
- * bool ret = false;
- * String out;
- *
* String pattern(L"(\\s+)([a-z]+)(\\d+)");
* String text(L" abcd1234test");
- * ArrayList list;
+ *
+ * ArrayList list(SingleObjectDeleter);
* list.Construct();
*
* RegularExpression regex;
* regex.Construct(pattern);
- * ret = regex.Consume(text, &list); // The list will contain four string instances
- * // and the text instance will be changed to L"test"
- * out = *(String *)list.GetAt(0); // L" abcd1234"
- * out = *(String *)list.GetAt(1); // L" "
- * out = *(String *)list.GetAt(2); // L"abcd"
- * out = *(String *)list.GetAt(3); // L"1234"
- *
- * list.RemoveAll(true);
+ * bool ret = regex.Consume(text, &list); // The list will contain four string instances
+ * // and the text instance will be changed to L"test"
+ * String out = *(dynamic_cast< String* >(list.GetAt(0))); // L" abcd1234"
+ * out = *(dynamic_cast< String* >(list.GetAt(1))); // L" "
+ * out = *(dynamic_cast< String* >(list.GetAt(2))); // L"abcd"
+ * out = *(dynamic_cast< String* >(list.GetAt(3))); // L"1234"
+ *
* @endcode
*/
bool Consume(Tizen::Base::String& text, Tizen::Base::Collection::IList* pMatchedString = null) const;
*
* @code
*
- * bool ret = false;
- * String out;
- *
* String pattern(L"(\\s+)([a-z]+)(\\d+)");
* String text(L"test abcd1234test");
- * ArrayList list;
+ *
+ * ArrayList list(SingleObjectDeleter);
* list.Construct();
*
* RegularExpression regex;
* regex.Construct(pattern);
- * ret = regex.FindAndConsume(text, &list); // The list will contain four String instances
- * // and text instance will be changed to L"test"
- * out = *(String *)list.GetAt(0); // L" abcd1234"
- * out = *(String *)list.GetAt(1); // L" "
- * out = *(String *)list.GetAt(2); // L"abcd"
- * out = *(String *)list.GetAt(3); // L"1234"
- *
- * list.RemoveAll(true);
+ * bool ret = regex.FindAndConsume(text, &list); // The list will contain four String instances
+ * // and text instance will be changed to L"test"
+ * String out = *(dynamic_cast< String* >(list.GetAt(0))); // L" abcd1234"
+ * out = *(dynamic_cast< String* >(list.GetAt(1))); // L" "
+ * out = *(dynamic_cast< String* >(list.GetAt(2))); // L"abcd"
+ * out = *(dynamic_cast< String* >(list.GetAt(3))); // L"1234"
+ *
* @endcode
*/
bool FindAndConsume(Tizen::Base::String& text, Tizen::Base::Collection::IList* pMatchedString = null) const;
*
* @code
*
- * bool ret = false;
- *
* String pattern(L"replace");
* String text(L"test replace method");
* String rewrite(L"REPLACE");
*
* RegularExpression regex;
* regex.Construct(pattern);
- * ret = regex.Replace(text, rewrite, false); // text = L"test REPLACE method"
+ * bool ret = regex.Replace(text, rewrite, false); // text = L"test REPLACE method"
*
* @endcode
*/
*
* @code
*
- * bool ret = false;
- * String out;
- *
* String pattern(L"(.*)@([^.]*)");
* String text(L"test@email.com");
* String rewrite(L"\\2!\\1");
*
* RegularExpression regex;
* regex.Construct(pattern);
- * ret = regex.Extract(text, rewrite, out); // out = L"email!test"
+ *
+ * String out;
+ * bool ret = regex.Extract(text, rewrite, out); // out = L"email!test"
*
* @endcode
*/
*/
Tizen::Base::String GetPattern(void) const;
-
/**
* Sets the value of the regular expression options.
*
*/
result SetOptions(unsigned long options);
-
/**
* Gets the value of the regular expression options.
*