LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Looking for helpful regex commands for checking a novel (https://www.linuxquestions.org/questions/linux-newbie-8/looking-for-helpful-regex-commands-for-checking-a-novel-4175549868/)

Gregg Bell 08-04-2015 11:50 PM

Looking for helpful regex commands for checking a novel
 
I'm just starting to realize the value of regular expressions in searching for errors in my novel. I plan on learning more about regex but if somebody had a list of common regex commands to search for common errors in a novel, that would be really helpful.

The kinds of things I would be looking for would be like:

--a period or comma outside of quotation marks

--quotation marks that are not completed

--double words

And a host of other things.

Thanks.

fatmac 08-05-2015 03:49 AM

The sed program is used by many publishers for doing this sort of thing.
https://en.wikipedia.org/wiki/Sedhtt...99261572,d.eXY

http://www.google.com/url?sa=t&rct=j...99261572,d.eXY

Gregg Bell 08-06-2015 12:23 AM

Quote:

Originally Posted by fatmac (Post 5401100)
The sed program is used by many publishers for doing this sort of thing.
https://en.wikipedia.org/wiki/Sedhtt...99261572,d.eXY

http://www.google.com/url?sa=t&rct=j...99261572,d.eXY

Thanks fatmac. sed looks like a great way to learn regex, but I'm just looking for the commands that will help right away. I looked at the link and really couldn't see anything that would do that.

pan64 08-06-2015 01:05 AM

I would say without analyzing sentences there is no way to find those errors. That means you will not find ready-made regexps to do the job. From the other hand if you want to learn regexps the best thing you can do is to construct your own ones and check, modify, alter, try, experiment.
you can find online sites like this: http://www.myezapp.com/apps/dev/regexp/show.ws to help

sycamorex 08-06-2015 02:08 AM

One of the best resources for learning sed is the following:
http://www.grymoire.com/Unix/Sed.html
It also includes a one-liner detecting duplicate words.


Detecting a comma or full stop after a blank space can be done as follows:
Code:

sed -n '/ \.\|,/p' file
Sed is very useful and the best way to learn it is to try to build the expressions on your own.

Gregg Bell 08-06-2015 11:40 PM

Quote:

Originally Posted by pan64 (Post 5401679)
I would say without analyzing sentences there is no way to find those errors. That means you will not find ready-made regexps to do the job. From the other hand if you want to learn regexps the best thing you can do is to construct your own ones and check, modify, alter, try, experiment.
you can find online sites like this: http://www.myezapp.com/apps/dev/regexp/show.ws to help

Thanks pan. Cool site. Don't know how to use it, yet. Saved it though.

Gregg Bell 08-06-2015 11:41 PM

Quote:

Originally Posted by sycamorex (Post 5401687)
One of the best resources for learning sed is the following:
http://www.grymoire.com/Unix/Sed.html
It also includes a one-liner detecting duplicate words.


Detecting a comma or full stop after a blank space can be done as follows:
Code:

sed -n '/ \.\|,/p' file
Sed is very useful and the best way to learn it is to try to build the expressions on your own.

Thanks sycamorex. I'm a little confused though. Is sed the same thing as regular expressions? I've heard of programs like RegexBuddy, but sed is completely new to me.

sycamorex 08-07-2015 12:13 AM

Quote:

Originally Posted by Gregg Bell (Post 5402247)
Thanks sycamorex. I'm a little confused though. Is sed the same thing as regular expressions? I've heard of programs like RegexBuddy, but sed is completely new to me.

No. Sed is a tool that uses regex (regular expressions) to do its operations.

Gregg Bell 08-07-2015 12:21 AM

Quote:

Originally Posted by sycamorex (Post 5402254)
No. Sed is a tool that uses regex (regular expressions) to do its operations.

Thanks

pan64 08-07-2015 02:17 AM

Quote:

Originally Posted by Gregg Bell (Post 5402246)
Thanks pan. Cool site. Don't know how to use it, yet. Saved it though.

You enter the regexp you created (or found somewhere) and that page will explain what that regexp means. Also you can find online regexp tester sites which will allow you to check how those regexps work (on sample texts)

Gregg Bell 08-07-2015 10:34 PM

Quote:

Originally Posted by pan64 (Post 5402286)
You enter the regexp you created (or found somewhere) and that page will explain what that regexp means. Also you can find online regexp tester sites which will allow you to check how those regexps work (on sample texts)

Thanks pan. Appreciate it.

damn.snarky.bastard 08-07-2015 11:17 PM

regex for novel.
 
Here's a web page I use.
abrambarneck.com/2013/10/21/fixing-common-errors-in-your-novel-with-find-and-replace-and-regex/

Gregg Bell 08-08-2015 02:34 PM

Quote:

Originally Posted by damn.snarky.bastard (Post 5402753)
Here's a web page I use.
abrambarneck.com/2013/10/21/fixing-common-errors-in-your-novel-with-find-and-replace-and-regex/

Wow, snarky. That's just the sort of thing I'm looking for! Thanks!!

damn.snarky.bastard 08-08-2015 06:06 PM

You're welcome Greg. I stumbled across it on day and bookmarked it.Besides, with my skill level your question was the only one I could give an intelligent answer too. (ha ha)

Gregg Bell 08-10-2015 11:33 AM

Quote:

Originally Posted by damn.snarky.bastard (Post 5403139)
You're welcome Greg. I stumbled across it on day and bookmarked it.Besides, with my skill level your question was the only one I could give an intelligent answer too. (ha ha)

Your skill level sounds like mine! LOL

Here's some things I've run across that could be helpful in finding errors in prose.

http://www.aidtopia.com/fiction/regexp.html

http://www.mobileread.com/forums/sho...d.php?t=167971

http://regexr.com/


All times are GMT -5. The time now is 10:36 PM.