[webkit-dev] YARR example

Michael Saboff msaboff at apple.com
Fri Jan 4 08:52:04 PST 2013


Ognian,

For the search to be case insensitive, you add an 'i' to the end of the regular expression.  The replace will be whatever string to have for the second argument.  See http://www.w3schools.com/jsref/jsref_replace.asp for an example of case-insensitive search/replace.

- Michael

On Jan 4, 2013, at 1:57 AM, Ognian Milanov <ogi.android at gmail.com> wrote:

> Thanks for your reply!
> 
> I already figured out how to make a case sensitive replacement with String::replace, which works exactly as I wanted. However case-insensitive replacement with (?i) doesn't work at all. Is this implementation specific, do I need to use other notation to indicate case insensitive matching?
> 
> Regards,
> Ognian
> 
> On Thu, Jan 3, 2013 at 6:28 PM, Michael Saboff <msaboff at apple.com> wrote:
> Ognian,
> 
> YARR is the regular expression engine for the JavaScriptCore part of webkit.  It can find the matches, but you would need to write other C++ code to do the replacement.  The String.replace() method will do what you want in JavaScript.
> 
> - Michael
> 
> 
> On Jan 3, 2013, at 4:16 AM, Ognian Milanov <ogi.android at gmail.com> wrote:
> 
> > Hello! I need info how to use YARR to replace all matches of a given regular expression in a string with another string. For example in Java this is achieved by String.replaceAll method.
> >
> > I will appreciate if someone leads me to the solution, thanks!
> > _______________________________________________
> > webkit-dev mailing list
> > webkit-dev at lists.webkit.org
> > http://lists.webkit.org/mailman/listinfo/webkit-dev
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130104/4a79d92c/attachment.html>


More information about the webkit-dev mailing list