0

Harvard bibliography, if you do not use Mendeley on time can get tough.

[Sihler 1999: 122; Trask 2000: 164]. 
[Benveniste 1935: 170-171, Бенвенист 1955, Bomhard, Kerns 1994: 56-59].

The way I quote authors in my PhD is wrong. It should have had a , instead of :. Like

[Sihler 1999, 122; Trask 2000, 164]. 

With \d{4}:\s\d+ http://regex101.com/r/mE0rT9/1 I can find them, but how to replace , instead of : in Word? Thanks.

Avinash Raj
  • 172,303
  • 28
  • 230
  • 274

2 Answers2

0

You need to use lookahead and lookbehind or backreferences, http://www.regular-expressions.info/lookaround.html.

I would probably do something like this: preg_replace("~(\d{4}):(\s\d+)~", "$1,$2", $str) in php for instance as an example of the latter solution.

Here's a post which talks about backreferences in javascript: JavaScript - string regex backreferences

Community
  • 1
  • 1
doliver
  • 980
  • 6
  • 7
  • Regex dialects tend to vary greatly. You'll have to find the equivalent constructs in your language. – doliver Oct 17 '14 at 18:44
0

Expression:

(?<=\d{4})\:

It uses a lookbehind to match but not return the year.

Community
  • 1
  • 1
Mr. Mascaro
  • 2,693
  • 1
  • 11
  • 18