1

I am trying to get the "dot -> •" between the words (A-z) with this regex, but I also get the char before and after the dot:

/[A-z](•)[A-z]/g

here is the text:

1.•Molde•FK••••••••••••1•1•0•0•3:1•3•
2.•Ajax•Amsterdam••••••1•0•1•0•2:2•1•
•.•Celtic•Glasgow••••••1•0•1•0•2:2•1•
4.•Fenerbahce•Istanbul•1•0•0•1•1:3•0•
Mike
  • 3,200
  • 5
  • 22
  • 33
  • Your RegEx already [matches the dot](https://regex101.com/r/iU3eO3/1). You *are* using a single capturing group. Depending on your implementation, the matching function might return the entire string as first element, followed by the actual captures. – dakab Oct 03 '15 at 16:14
  • @dakab - yes but the chars get also removed. the "lookbehind" syntax is not working in jQuery. – Mike Oct 03 '15 at 16:21

1 Answers1

1

Change [A-z] to [A-Za-z]. And get the string you want from group index 1.

/[a-z](•)[a-z]/gi

or

/[a-z](•)(?=[a-z])/gi
Avinash Raj
  • 172,303
  • 28
  • 230
  • 274
  • I am using jQuery as lang - the "lookbehind" syntax is not working for me with jQuery and ´/[a-z](•)[a-z]/gi´ also removes the last and first char of the words. – Mike Oct 03 '15 at 16:19
  • just fetch the dot from group index 1. – Avinash Raj Oct 03 '15 at 16:23
  • not bad but the char before the dot is still here --> https://regex101.com/r/mQ3dB2/1 – Mike Oct 03 '15 at 16:26
  • @Mike ya, lookbehinds are not possible in js , so it always matches the previous character but you can get the captured character by the js lang itself. – Avinash Raj Oct 03 '15 at 16:32