Hi,
I have few column name like below :
col1
col2
col3
Now I want the output like :
a.col1 / b.col1
a.col2 / b.col2
a.col3 / b.col3
I am trying to achieve it in text editor like Editplus which support regular expression.
Can anyone please help me to achieve the result here.
Regards,
Koushik
Search - Replace using regular expression
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Search - Replace using regular expression
I am not exactly sure, but it should be something like "s/^.*$/a\.& \/ b\.&/g"
(#10850)
- ridgerunner
- Forum Contributor
- Posts: 214
- Joined: Sun Jul 05, 2009 10:39 pm
- Location: SLC, UT
Re: Search - Replace using regular expression
Try this:
Code: Select all
Search pattern:
^([A-Za-z0-9]+)$
Replacement string:
a.\1 / b.\1Re: Search - Replace using regular expression
Thanks a lot. The following solution works perfectly.
Search pattern:
^([A-Za-z0-9]+)$
Replacement string:
a.\1 / b.\1
Regards,
Koushik
Search pattern:
^([A-Za-z0-9]+)$
Replacement string:
a.\1 / b.\1
Regards,
Koushik
Re: Search - Replace using regular expression
I stuck with another problem. I have the following strings :
src_sys_nm in ('SAP-AP0')
src_sys_nm in ('SAP-AP0','SAP-AP0-PRG')
src_sys_nm in ('SAP-EP0','SAP-AP0','SAP-EP1')
src_sys_nm in ('SAP-EP0','SAP-EP1','SAP-AP0')
And I want to get (basically all SAP-AP0* will be replaced by SAP-AP0*,SBI-NBP*):
src_sys_nm in ('SAP-AP0','SBI-NBP')
src_sys_nm in ('SAP-AP0','SBI-NBP','SAP-AP0-PRG','SBI-NBP-PRG')
src_sys_nm in ('SAP-EP0','SAP-AP0','SBI-NBP','SAP-EP1')
src_sys_nm in ('SAP-EP0','SAP-EP1','SAP-AP0','SBI-NBP')
I can achieve it using the search string : (SAP-AP0)(-)*([a-z|A-Z|0-9]*) and the replacement string : SAP-AP0\2\3','SBI-NBP\2\3
But If I have the strings like below :
src_sys_nm in ('SAP-AP0','SBI-NBP') --- for this string SBI-NBP is already there
src_sys_nm in ('SAP-AP0','SAP-AP0-PRG')
src_sys_nm in ('SAP-EP0','SAP-AP0','SAP-EP1')
src_sys_nm in ('SAP-EP0','SAP-EP1','SAP-AP0')
So for the above case I don't want to replace in the 1st occurrence as SBI-NBP is already there but want to replace the next 3 lines means I just want to skip the 1st line here.
Can you please suggest how should I achieve this.
Regards
Koushik
src_sys_nm in ('SAP-AP0')
src_sys_nm in ('SAP-AP0','SAP-AP0-PRG')
src_sys_nm in ('SAP-EP0','SAP-AP0','SAP-EP1')
src_sys_nm in ('SAP-EP0','SAP-EP1','SAP-AP0')
And I want to get (basically all SAP-AP0* will be replaced by SAP-AP0*,SBI-NBP*):
src_sys_nm in ('SAP-AP0','SBI-NBP')
src_sys_nm in ('SAP-AP0','SBI-NBP','SAP-AP0-PRG','SBI-NBP-PRG')
src_sys_nm in ('SAP-EP0','SAP-AP0','SBI-NBP','SAP-EP1')
src_sys_nm in ('SAP-EP0','SAP-EP1','SAP-AP0','SBI-NBP')
I can achieve it using the search string : (SAP-AP0)(-)*([a-z|A-Z|0-9]*) and the replacement string : SAP-AP0\2\3','SBI-NBP\2\3
But If I have the strings like below :
src_sys_nm in ('SAP-AP0','SBI-NBP') --- for this string SBI-NBP is already there
src_sys_nm in ('SAP-AP0','SAP-AP0-PRG')
src_sys_nm in ('SAP-EP0','SAP-AP0','SAP-EP1')
src_sys_nm in ('SAP-EP0','SAP-EP1','SAP-AP0')
So for the above case I don't want to replace in the 1st occurrence as SBI-NBP is already there but want to replace the next 3 lines means I just want to skip the 1st line here.
Can you please suggest how should I achieve this.
Regards
Koushik