Re: How to have \D ignore newline character?

2021-12-13 Thread Tim A
Learning that regular expressions is often about focussing on key trees in 
the forest.
This is a great way to learn. Thanks all.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/55eacad1-7695-460f-a51b-ec20b209d4c6n%40googlegroups.com.


Re: How to have \D ignore newline character?

2021-12-13 Thread ThePorgie
Much prettier & easier to read sirWell played.

On Monday, December 13, 2021 at 2:19:51 PM UTC-5 listmei...@gmail.com wrote:

> On Dec 12, 2021, at 23:38, Tim A  wrote:
>
> Deepening the challenge, the phone numbers are actually in the second of 
> three columns separated by tabs. If I can get the phone numbers stripped I 
> can then impose a uniform format on them.
>
> --
>
> Hey Tim,
>
> Find:
>
> [(]?(\d{3})\D*(\d{3})\D*(\d{4})
>
> Replace:
>
> \1-\2-\3
>
>
> --
> Best Regards,
> Chris
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/a737c258-cdae-4074-831b-51955fa3a9aen%40googlegroups.com.


Re: How to have \D ignore newline character?

2021-12-13 Thread Christopher Stone
> On Dec 12, 2021, at 23:38, Tim A  wrote:
> Deepening the challenge, the phone numbers are actually in the second of 
> three columns separated by tabs. If I can get the phone numbers stripped I 
> can then impose a uniform format on them.

Hey Tim,

Find:

[(]?(\d{3})\D*(\d{3})\D*(\d{4})

Replace:

\1-\2-\3


--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/A6446566-AB8A-41E0-A9BF-C650D902835E%40gmail.com.


Re: How to have \D ignore newline character?

2021-12-13 Thread Tim A
On Monday, December 13, 2021 at 6:36:13 AM UTC-8 ThePorgie wrote:

> Pulling your text and replacing the spaces in the tab areas and then 
> Running the following
> (?:[- (\.\d]+)?(\d{3})(?:[- )\.]+)?(\d{3})(?:[- )\.]+)?(\d{4})
> with a replacement of
> \1-\2-\3  Is that what your looking for?
>
 
Ah, a non capture of a possible crud character then capturing the three 
numeric groups.
Finally hyphenating the result.
Thanks.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/53f56ad1-3086-460f-ae0b-33d949372959n%40googlegroups.com.


Re: How to have \D ignore newline character?

2021-12-13 Thread ThePorgie

"...replacing the spaces in the tab areas..." Should of added "to simulate 
the text you describe."
On Monday, December 13, 2021 at 9:36:13 AM UTC-5 ThePorgie wrote:

> Pulling your text and replacing the spaces in the tab areas and then 
> Running the following
> (?:[- (\.\d]+)?(\d{3})(?:[- )\.]+)?(\d{3})(?:[- )\.]+)?(\d{4})
> with a replacement of
> \1-\2-\3
> yields the following
> Name1123-456-7890Single Lifetime
> Name2123-456-7890Joint Lifetime
> Name3123-456-7890Joint Lifetime
> Name4123-456-7890Single
> Name5123-456-7890Single
> Name6123-456-7890Single
> Name7123-456-7890Joint
> Name8123-456-7890Joint
>
> Is that what your looking for?
>
> On Monday, December 13, 2021 at 8:41:06 AM UTC-5 Tim A wrote:
>
>> *Try using a negative character class like [^\d\n\r] *
>> That will do it! .. and as an extra benefit catches any periods used as a 
>> delimiter as well.
>>
>> Deepening the challenge, the phone numbers are actually in the second of 
>> three columns separated by tabs. If I can get the phone numbers stripped I 
>> can then impose a uniform format on them. But how do I focus the 
>> find/replace on just this second column? I can do this in many small steps, 
>> but figure there must be an elegant way to do it in a single step.
>>
>> Before...
>>
>> Name11234567890Single Lifetime
>> Name2123-4567890Joint Lifetime
>> Name3123-456-7890Joint Lifetime
>> Name4(123)4567890Single
>> Name5(123) 4567890Single
>> Name6(123)-4567890Single
>> Name7(123)456-7890Joint
>> Name8123.456.7890Joint
>>
>> After...
>> Name11234567890SingleLifetime
>> Name21234567890JointLifetime
>> Name31234567890JointLifetime
>> Name41234567890Single
>> Name51234567890Single
>> Name61234567890Single
>> Name71234567890Joint
>> Name81234567890Joint
>>
>>
>>
>>
>>
>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/c82d1992-768c-4f68-9343-ad2b70b0ee7an%40googlegroups.com.


Re: How to have \D ignore newline character?

2021-12-13 Thread ThePorgie
Pulling your text and replacing the spaces in the tab areas and then 
Running the following
(?:[- (\.\d]+)?(\d{3})(?:[- )\.]+)?(\d{3})(?:[- )\.]+)?(\d{4})
with a replacement of
\1-\2-\3
yields the following
Name1123-456-7890Single Lifetime
Name2123-456-7890Joint Lifetime
Name3123-456-7890Joint Lifetime
Name4123-456-7890Single
Name5123-456-7890Single
Name6123-456-7890Single
Name7123-456-7890Joint
Name8123-456-7890Joint

Is that what your looking for?

On Monday, December 13, 2021 at 8:41:06 AM UTC-5 Tim A wrote:

> *Try using a negative character class like [^\d\n\r] *
> That will do it! .. and as an extra benefit catches any periods used as a 
> delimiter as well.
>
> Deepening the challenge, the phone numbers are actually in the second of 
> three columns separated by tabs. If I can get the phone numbers stripped I 
> can then impose a uniform format on them. But how do I focus the 
> find/replace on just this second column? I can do this in many small steps, 
> but figure there must be an elegant way to do it in a single step.
>
> Before...
>
> Name11234567890Single Lifetime
> Name2123-4567890Joint Lifetime
> Name3123-456-7890Joint Lifetime
> Name4(123)4567890Single
> Name5(123) 4567890Single
> Name6(123)-4567890Single
> Name7(123)456-7890Joint
> Name8123.456.7890Joint
>
> After...
> Name11234567890SingleLifetime
> Name21234567890JointLifetime
> Name31234567890JointLifetime
> Name41234567890Single
> Name51234567890Single
> Name61234567890Single
> Name71234567890Joint
> Name81234567890Joint
>
>
>
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/849d58f0-20dd-4219-8fa1-44e697ab3473n%40googlegroups.com.


Re: How to have \D ignore newline character?

2021-12-13 Thread Tim A
*Try using a negative character class like [^\d\n\r] *
That will do it! .. and as an extra benefit catches any periods used as a 
delimiter as well.

Deepening the challenge, the phone numbers are actually in the second of 
three columns separated by tabs. If I can get the phone numbers stripped I 
can then impose a uniform format on them. But how do I focus the 
find/replace on just this second column? I can do this in many small steps, 
but figure there must be an elegant way to do it in a single step.

Before...

Name11234567890Single Lifetime
Name2123-4567890Joint Lifetime
Name3123-456-7890Joint Lifetime
Name4(123)4567890Single
Name5(123) 4567890Single
Name6(123)-4567890Single
Name7(123)456-7890Joint
Name8123.456.7890Joint

After...
Name11234567890SingleLifetime
Name21234567890JointLifetime
Name31234567890JointLifetime
Name41234567890Single
Name51234567890Single
Name61234567890Single
Name71234567890Joint
Name81234567890Joint





-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/5002840c-ec2e-4a75-b60c-887dd64f7009n%40googlegroups.com.