Capture words in a sentence

A discussion of how to use EasyPatterns, EasyPattern Helper and using the EasyPattern library.

Moderator: DataMystic Support

pmccarthy
Posts: 2
Joined: Sat Feb 06, 2016 2:09 pm

Capture words in a sentence

Postby pmccarthy » Sat Feb 06, 2016 2:13 pm

Hello,

I'm having a bit of trouble getting this... a lot more examples would be helpful. For instance, can someone show me how one might capture all the words in a sentence? Reverse all the words in a sentence?

Thanks

Paul

User avatar
DataMystic Support
Site Admin
Posts: 2154
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Capture words in a sentence

Postby DataMystic Support » Sat Feb 06, 2016 4:11 pm

To capture the words in a sentence, an EasyPattern such as

Code: Select all

[ 1+ (word, 1 or more spaces or cr or lf), word, period ]


Would be a good place to start.

Why would you need to reverse the words in a sentence?

The best way to do this would be to use the EasyPattern above in TextPipe, send the match to a subfilter. In the subfilter, use
Filters\Convert\Text to word list
Filters\Special\Reverse line order
Then replace cr/lf with spaces to join the words back into a sentence again.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

pmccarthy
Posts: 2
Joined: Sat Feb 06, 2016 2:09 pm

Re: Capture words in a sentence

Postby pmccarthy » Sun Feb 07, 2016 8:37 am

Like if AD had everyone's name as Last Name, First Name and you wanted them as First Name Last Name... for instance...

User avatar
DataMystic Support
Site Admin
Posts: 2154
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Capture words in a sentence

Postby DataMystic Support » Sun Feb 07, 2016 2:05 pm

ok, but then that's not a sentence.

Code: Select all

[ capture(word), 1 or more spaces, capture(word) ]


Replace with

Code: Select all

$2,$1
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

DFH
Posts: 644
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Re: Capture words in a sentence

Postby DFH » Tue Feb 23, 2016 1:45 am

Some sentences end with a different punctuation mark. e.g.
    ?
    !
And, depending on the locale, some might even end with a quotation mark.

NB. There are even sentences where a final punctuation mark should be omitted. e.g.
The URL for DataMystic is http://www.datamystic.com/


Regards,

David


Return to “EasyPatterns Support”

Who is online

Users browsing this forum: No registered users and 1 guest