?
Solved

regExp for no space after period

Posted on 2002-06-24
2
Medium Priority
?
214 Views
Last Modified: 2010-05-18
I'm processing a text file that has frequent 'no space after a period' typos. Reading OReilly's JS Definitive I thought that I'd use:

\.\w

or possibly

\.\S

to find these instances but both apps I've tried this in (editPlus and Fund' Search & Replace are finding only instance of a . followed by a 'w' or 'S' respectively.

Both apps support reg expressions well enough that I'm sure the error is mine... So how do I find instances where a period is followed by anything except a space character?

thankx
--steve...
0
Comment
Question by:juststeve
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 7104223
I tried this with Javascript, and it worked:


var str1 = "abc. def.ghi. 123";
var str2 = str1.replace(/\.\S/g,". ");
alert(str2);
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 400 total points
ID: 7104336
... but there is a problem with more than one occurance ...

maybe you could forct the issue like this:

var str1 = "abcd. efg.hij klm.nop qrs.tuv wxyz.";
var str2 = str1.replace(/\.\s/g,".");  // first, force all dots to have no trailing space
var str3 = str2.replace(/\./g, ". ");  // then force all dots to have a space
alert(str3);
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question