You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Ashish Vijaywargiya <as...@hotwaxmedia.com> on 2009/03/19 06:24:34 UTC

How to use Regular Expression for Search & Replace in Eclipse ?

Hello Jacques,

I noticed that you have done couple of work in the area to search any 
string and replace with other string by the use of Regular Expression 
using Eclipse.

Do we have some "How To docs" on ofbiz confluence or somewhere else ? 
(searched on confluence but didn't fine any :( )
Are you using some plugin for this job ?
Do you have some script that you use and update as per the new 
requirement for replacements of any string ?

Can you please share your thoughts on this as soon as you get a chance.
If this has been discussed on mailing list then can you please share me 
that thread ?

Thanks in advance for any pointer !

--
Ashish



Re: How to use Regular Expression for Search & Replace in Eclipse ?

Posted by Ashish Vijaywargiya <as...@hotwaxmedia.com>.
Thanks Jacques.
I will give it a try.

--
Ashish Vijaywargiya

Jacques Le Roux wrote:
> Done at 
> http://docs.ofbiz.org/display/OFBIZ/Eclipse+Tips#EclipseTips-HowtouseRegularExpressionforSearch&ReplaceinEclipse? 
>
>
> Jacques
>
> From: "Jacques Le Roux" <ja...@les7arts.com>
>> Thanks Paul,
>>
>> I think it will be great to share our tips in a wiki page. I will 
>> open one soon...
>>
>> Jacques
>>
>> From: "madppiper" <pa...@mutschler.ch>
>>>
>>> Well, the feature itself uses the standard java regular expressions 
>>> and is
>>> actually fairly simple to understand. I would recommend to have a go at
>>> regular expressions before trying that feature. For instance, you 
>>> can try
>>>
>>> http://www.gskinner.com/RegExr/
>>> or
>>> http://www.regextester.com
>>>
>>>
>>> to test the results. Another great read is also:
>>>
>>> http://java.sun.com/developer/technicalArticles/releases/1.4regex/
>>>
>>> Be aware that there are different types of regexp. So not all 
>>> commands may
>>> work (luckily, eclipse displays the available commands on the input 
>>> dialog)
>>>
>>>
>>> Btw, a great one I use quite often is this: <TAG\b[^>]*>(.*?)</TAG>
>>> It'll grab the start and ending ending of a specified html tag. You 
>>> can then
>>> use the select the inner element using $1 :)
>>>
>>> -- 
>>> View this message in context: 
>>> http://www.nabble.com/How-to-use-Regular-Expression-for-Search---Replace-in-Eclipse---tp22593950p22596320.html 
>>>
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>
>>
>

Re: How to use Regular Expression for Search & Replace in Eclipse ?

Posted by Jacques Le Roux <ja...@les7arts.com>.
Done at http://docs.ofbiz.org/display/OFBIZ/Eclipse+Tips#EclipseTips-HowtouseRegularExpressionforSearch&ReplaceinEclipse?

Jacques

From: "Jacques Le Roux" <ja...@les7arts.com>
> Thanks Paul,
> 
> I think it will be great to share our tips in a wiki page. I will open one soon...
> 
> Jacques
> 
> From: "madppiper" <pa...@mutschler.ch>
>>
>> Well, the feature itself uses the standard java regular expressions and is
>> actually fairly simple to understand. I would recommend to have a go at
>> regular expressions before trying that feature. For instance, you can try
>>
>> http://www.gskinner.com/RegExr/
>> or
>> http://www.regextester.com
>>
>>
>> to test the results. Another great read is also:
>>
>> http://java.sun.com/developer/technicalArticles/releases/1.4regex/
>>
>> Be aware that there are different types of regexp. So not all commands may
>> work (luckily, eclipse displays the available commands on the input dialog)
>>
>>
>> Btw, a great one I use quite often is this: <TAG\b[^>]*>(.*?)</TAG>
>> It'll grab the start and ending ending of a specified html tag. You can then
>> use the select the inner element using $1 :)
>>
>> -- 
>> View this message in context: 
>> http://www.nabble.com/How-to-use-Regular-Expression-for-Search---Replace-in-Eclipse---tp22593950p22596320.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>> 
> 
>


Re: How to use Regular Expression for Search & Replace in Eclipse ?

Posted by Stephen Rufle <sr...@salmonllc.com>.
When I have done regexp search and replace operations on some of my own
code I like to codify it in a python script. Sometimes the script may
contain the list of files that are to be worked on, sometimes I just ask
the script to glob a pattern recursively acting on files. Recently I
have also used the same sort of technique for transforming xml data
files using the standard xml processing lib's in python to help myself
with customer data import tasks.

 

Jacques Le Roux wrote:
> Thanks Paul,
>
> I think it will be great to share our tips in a wiki page. I will open
> one soon...
>
> Jacques
>
> From: "madppiper" <pa...@mutschler.ch>
>>
>> Well, the feature itself uses the standard java regular expressions
>> and is
>> actually fairly simple to understand. I would recommend to have a go at
>> regular expressions before trying that feature. For instance, you can
>> try
>>
>> http://www.gskinner.com/RegExr/
>> or
>> http://www.regextester.com
>>
>>
>> to test the results. Another great read is also:
>>
>> http://java.sun.com/developer/technicalArticles/releases/1.4regex/
>>
>> Be aware that there are different types of regexp. So not all
>> commands may
>> work (luckily, eclipse displays the available commands on the input
>> dialog)
>>
>>
>> Btw, a great one I use quite often is this: <TAG\b[^>]*>(.*?)</TAG>
>> It'll grab the start and ending ending of a specified html tag. You
>> can then
>> use the select the inner element using $1 :)
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/How-to-use-Regular-Expression-for-Search---Replace-in-Eclipse---tp22593950p22596320.html
>>
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>
>
>
>

-- 
Stephen P Rufle
srufle@salmonllc.com
H1:480-626-8022
H2:480-802-7173
Yahoo IM: stephen_rufle
AOL IM: stephen1rufle


Re: How to use Regular Expression for Search & Replace in Eclipse ?

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Paul,

I think it will be great to share our tips in a wiki page. I will open one soon...

Jacques

From: "madppiper" <pa...@mutschler.ch>
>
> Well, the feature itself uses the standard java regular expressions and is
> actually fairly simple to understand. I would recommend to have a go at
> regular expressions before trying that feature. For instance, you can try
>
> http://www.gskinner.com/RegExr/
> or
> http://www.regextester.com
>
>
> to test the results. Another great read is also:
>
> http://java.sun.com/developer/technicalArticles/releases/1.4regex/
>
> Be aware that there are different types of regexp. So not all commands may
> work (luckily, eclipse displays the available commands on the input dialog)
>
>
> Btw, a great one I use quite often is this: <TAG\b[^>]*>(.*?)</TAG>
> It'll grab the start and ending ending of a specified html tag. You can then
> use the select the inner element using $1 :)
>
> -- 
> View this message in context: 
> http://www.nabble.com/How-to-use-Regular-Expression-for-Search---Replace-in-Eclipse---tp22593950p22596320.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
> 



Re: How to use Regular Expression for Search & Replace in Eclipse ?

Posted by madppiper <pa...@mutschler.ch>.
Well, the feature itself uses the standard java regular expressions and is
actually fairly simple to understand. I would recommend to have a go at
regular expressions before trying that feature. For instance, you can try

http://www.gskinner.com/RegExr/
or
http://www.regextester.com


to test the results. Another great read is also:

http://java.sun.com/developer/technicalArticles/releases/1.4regex/

Be aware that there are different types of regexp. So not all commands may
work (luckily, eclipse displays the available commands on the input dialog)


Btw, a great one I use quite often is this: <TAG\b[^>]*>(.*?)</TAG>
It'll grab the start and ending ending of a specified html tag. You can then
use the select the inner element using $1 :)

-- 
View this message in context: http://www.nabble.com/How-to-use-Regular-Expression-for-Search---Replace-in-Eclipse---tp22593950p22596320.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: How to use Regular Expression for Search & Replace in Eclipse ?

Posted by Ashish Vijaywargiya <as...@hotwaxmedia.com>.
Inline :

Jacques Le Roux wrote:
> Also Ashish, don't worry about the 741 remaining occurences of 
> <service name=(.*)engine="simple"(.*)\R(.*)location="org.ofbiz
>
> I can deal with that if you want, 
I am fine if it takes less time for you. Please do the needful as soon 
as you get a chance.
As you can see in the previous email in another thread that David is 
also interested to get rid of this ASAP before ofbiz another release in 
end of march.
 
Yesterday I have spent around 20 minutes in night for all the commits I 
have done today and in my opinion that is considerable time frame for 
such work.
Thanks !

--
Ashish Vijaywargiya

> tough of course being more to do large Searchs/Replacements would help.
> But we warned, it's an hard beast and I have been bitten many times by 
> it ;o)
>
> Jacques
>
> From: "Ashish Vijaywargiya" <as...@hotwaxmedia.com>
>> Thanks Jacques for your quick reply on this.
>> Inline :
>>
>> Jacques Le Roux wrote:
>>> Hi Ashish,
>>>
>>> You don't need anything else than last Eclipse version.
>>>
>>> When it comes to large changes, I don't like much hand-coding. It's 
>>> tedious and error prone.
>>> So, as you can see in the following links I have been batlle from 
>>> the beginning for a S/R powerful feature in Eclipse but I had to 
>>> wait 3.4M1 to have the R part really working.
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=196783
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=155565
>>> BTW, I'm still waiting for this one :o)
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=200039
>> +1, it would be great to have this feature in next release of Eclipse.
>>
>>>
>>> I will soon write a tip in 
>>> http://docs.ofbiz.org/display/OFBIZ/Eclipse+Tips
>>>
>> I'll wait for your tips on this but in the meantime I will try to 
>> explore this feature from the help content available in eclipse at 
>> Help --> Help Contents (by searching "regular expression").
>> Please share the tips through email as soon as you are done with that.
>>
>> FYI, I have enabled the mail notification feature for any changes on 
>> the confluence pages but in case if I miss your changes then your 
>> email on ML will be of great help for me :-).
>>
>> -- 
>> Ashish Vijaywargiya
>>
>>> Jacques
>>>
>>> From: "Ashish Vijaywargiya" <as...@hotwaxmedia.com>
>>>> Hello Jacques,
>>>>
>>>> I noticed that you have done couple of work in the area to search 
>>>> any string and replace with other string by the use of Regular 
>>>> Expression using Eclipse.
>>>>
>>>> Do we have some "How To docs" on ofbiz confluence or somewhere else 
>>>> ? (searched on confluence but didn't fine any :( )
>>>> Are you using some plugin for this job ?
>>>> Do you have some script that you use and update as per the new 
>>>> requirement for replacements of any string ?
>>>>
>>>> Can you please share your thoughts on this as soon as you get a 
>>>> chance.
>>>> If this has been discussed on mailing list then can you please 
>>>> share me that thread ?
>>>>
>>>> Thanks in advance for any pointer !
>>>>
>>>> -- 
>>>> Ashish
>>>>
>>>>
>>>>
>>>
>>>
>>
>

Re: How to use Regular Expression for Search & Replace in Eclipse ?

Posted by Jacques Le Roux <ja...@les7arts.com>.
Also Ashish, don't worry about the 
741 remaining occurences of 
<service name=(.*)engine="simple"(.*)\R(.*)location="org.ofbiz

I can deal with that if you want, tough of course being more to do large Searchs/Replacements would help.
But we warned, it's an hard beast and I have been bitten many times by it ;o)

Jacques

From: "Ashish Vijaywargiya" <as...@hotwaxmedia.com>
> Thanks Jacques for your quick reply on this.
> Inline :
> 
> Jacques Le Roux wrote:
>> Hi Ashish,
>>
>> You don't need anything else than last Eclipse version.
>>
>> When it comes to large changes, I don't like much hand-coding. It's 
>> tedious and error prone.
>> So, as you can see in the following links I have been batlle from the 
>> beginning for a S/R powerful feature in Eclipse but I had to wait 
>> 3.4M1 to have the R part really working.
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=196783
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=155565
>> BTW, I'm still waiting for this one :o)
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=200039
> +1, it would be great to have this feature in next release of Eclipse.
> 
>>
>> I will soon write a tip in 
>> http://docs.ofbiz.org/display/OFBIZ/Eclipse+Tips
>>
> I'll wait for your tips on this but in the meantime I will try to 
> explore this feature from the help content available in eclipse at Help 
> --> Help Contents (by searching "regular expression").
> Please share the tips through email as soon as you are done with that.
> 
> FYI, I have enabled the mail notification feature for any changes on the 
> confluence pages but in case if I miss your changes then your email on 
> ML will be of great help for me :-).
> 
> --
> Ashish Vijaywargiya
> 
>> Jacques
>>
>> From: "Ashish Vijaywargiya" <as...@hotwaxmedia.com>
>>> Hello Jacques,
>>>
>>> I noticed that you have done couple of work in the area to search any 
>>> string and replace with other string by the use of Regular Expression 
>>> using Eclipse.
>>>
>>> Do we have some "How To docs" on ofbiz confluence or somewhere else ? 
>>> (searched on confluence but didn't fine any :( )
>>> Are you using some plugin for this job ?
>>> Do you have some script that you use and update as per the new 
>>> requirement for replacements of any string ?
>>>
>>> Can you please share your thoughts on this as soon as you get a chance.
>>> If this has been discussed on mailing list then can you please share 
>>> me that thread ?
>>>
>>> Thanks in advance for any pointer !
>>>
>>> -- 
>>> Ashish
>>>
>>>
>>>
>>
>>
>


Re: How to use Regular Expression for Search & Replace in Eclipse ?

Posted by Ashish Vijaywargiya <as...@hotwaxmedia.com>.
Thanks Jacques for your quick reply on this.
Inline :

Jacques Le Roux wrote:
> Hi Ashish,
>
> You don't need anything else than last Eclipse version.
>
> When it comes to large changes, I don't like much hand-coding. It's 
> tedious and error prone.
> So, as you can see in the following links I have been batlle from the 
> beginning for a S/R powerful feature in Eclipse but I had to wait 
> 3.4M1 to have the R part really working.
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=196783
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=155565
> BTW, I'm still waiting for this one :o)
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=200039
+1, it would be great to have this feature in next release of Eclipse.

>
> I will soon write a tip in 
> http://docs.ofbiz.org/display/OFBIZ/Eclipse+Tips
>
I'll wait for your tips on this but in the meantime I will try to 
explore this feature from the help content available in eclipse at Help 
--> Help Contents (by searching "regular expression").
Please share the tips through email as soon as you are done with that.

FYI, I have enabled the mail notification feature for any changes on the 
confluence pages but in case if I miss your changes then your email on 
ML will be of great help for me :-).

--
Ashish Vijaywargiya

> Jacques
>
> From: "Ashish Vijaywargiya" <as...@hotwaxmedia.com>
>> Hello Jacques,
>>
>> I noticed that you have done couple of work in the area to search any 
>> string and replace with other string by the use of Regular Expression 
>> using Eclipse.
>>
>> Do we have some "How To docs" on ofbiz confluence or somewhere else ? 
>> (searched on confluence but didn't fine any :( )
>> Are you using some plugin for this job ?
>> Do you have some script that you use and update as per the new 
>> requirement for replacements of any string ?
>>
>> Can you please share your thoughts on this as soon as you get a chance.
>> If this has been discussed on mailing list then can you please share 
>> me that thread ?
>>
>> Thanks in advance for any pointer !
>>
>> -- 
>> Ashish
>>
>>
>>
>
>

Re: How to use Regular Expression for Search & Replace in Eclipse ?

Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Ashish,

You don't need anything else than last Eclipse version.

When it comes to large changes, I don't like much hand-coding. It's tedious and error prone.
So, as you can see in the following links I have been batlle from the beginning for a S/R powerful feature in Eclipse but I had to 
wait 3.4M1 to have the R part really working.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=196783
https://bugs.eclipse.org/bugs/show_bug.cgi?id=155565
BTW, I'm still waiting for this one :o)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=200039

I will soon write a tip in http://docs.ofbiz.org/display/OFBIZ/Eclipse+Tips

Jacques

From: "Ashish Vijaywargiya" <as...@hotwaxmedia.com>
> Hello Jacques,
>
> I noticed that you have done couple of work in the area to search any string and replace with other string by the use of Regular 
> Expression using Eclipse.
>
> Do we have some "How To docs" on ofbiz confluence or somewhere else ? (searched on confluence but didn't fine any :( )
> Are you using some plugin for this job ?
> Do you have some script that you use and update as per the new requirement for replacements of any string ?
>
> Can you please share your thoughts on this as soon as you get a chance.
> If this has been discussed on mailing list then can you please share me that thread ?
>
> Thanks in advance for any pointer !
>
> --
> Ashish
>
>
>