LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-05-2015, 12:50 AM   #1
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 1,536

Rep: Reputation: 99
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.
 
Old 08-05-2015, 04:49 AM   #2
fatmac
Senior Member
 
Registered: Sep 2011
Location: Surrey/Hants Border, UK
Distribution: BSD & Linux - As long as they are Lightweight
Posts: 1,704

Rep: Reputation: Disabled
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

Last edited by fatmac; 08-05-2015 at 04:51 AM.
 
1 members found this post helpful.
Old 08-06-2015, 01:23 AM   #3
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 1,536

Original Poster
Rep: Reputation: 99
Quote:
Originally Posted by fatmac View Post
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.
 
Old 08-06-2015, 02:05 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,512

Rep: Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434
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
 
1 members found this post helpful.
Old 08-06-2015, 03:08 AM   #5
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,819
Blog Entries: 1

Rep: Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200
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.
 
1 members found this post helpful.
Old 08-07-2015, 12:40 AM   #6
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 1,536

Original Poster
Rep: Reputation: 99
Quote:
Originally Posted by pan64 View Post
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.
 
Old 08-07-2015, 12:41 AM   #7
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 1,536

Original Poster
Rep: Reputation: 99
Quote:
Originally Posted by sycamorex View Post
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.
 
Old 08-07-2015, 01:13 AM   #8
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,819
Blog Entries: 1

Rep: Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200
Quote:
Originally Posted by Gregg Bell View Post
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.
 
1 members found this post helpful.
Old 08-07-2015, 01:21 AM   #9
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 1,536

Original Poster
Rep: Reputation: 99
Quote:
Originally Posted by sycamorex View Post
No. Sed is a tool that uses regex (regular expressions) to do its operations.
Thanks
 
Old 08-07-2015, 03:17 AM   #10
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,512

Rep: Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434
Quote:
Originally Posted by Gregg Bell View Post
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)
 
1 members found this post helpful.
Old 08-07-2015, 11:34 PM   #11
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 1,536

Original Poster
Rep: Reputation: 99
Quote:
Originally Posted by pan64 View Post
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.
 
Old 08-08-2015, 12:17 AM   #12
damn.snarky.bastard
Member
 
Registered: Aug 2015
Posts: 39

Rep: Reputation: Disabled
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/
 
1 members found this post helpful.
Old 08-08-2015, 03:34 PM   #13
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 1,536

Original Poster
Rep: Reputation: 99
Quote:
Originally Posted by damn.snarky.bastard View Post
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!!
 
Old 08-08-2015, 07:06 PM   #14
damn.snarky.bastard
Member
 
Registered: Aug 2015
Posts: 39

Rep: Reputation: Disabled
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)
 
1 members found this post helpful.
Old 08-10-2015, 12:33 PM   #15
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 1,536

Original Poster
Rep: Reputation: 99
Quote:
Originally Posted by damn.snarky.bastard View Post
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/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Confusing issue with Perl regEx - Regex check seems to require variable being set EnderX Programming 1 09-07-2013 05:36 AM
[SOLVED] differences between shell regex and php regex and perl regex and javascript and mysql golden_boy615 Linux - General 2 04-19-2011 02:10 AM
Helpful Linux commands parent's_basement Linux - Newbie 8 02-12-2009 12:17 PM
checking for return status between multiple commands vickylife Linux - Newbie 3 11-19-2008 01:33 PM
Anywhere to go for helpful commands? MooCows Linux - Newbie 7 12-30-2004 05:33 PM


All times are GMT -5. The time now is 04:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration