w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
javascript regex match all occurrences of substring?

If you are just after a list of the patent numbers, can you not just run the regex and remove duplicates?

 var str =
"CN302434403A_,CN302434403A_20320433,2032-04-33,MEISTRICK ZDENEK S,GOOGLE
SYSTEMS INC,DEDICATED ROCKER ARM ENGINE
BRAKE,EP2425305A3,EP2425305A320320307,2032-03-07,MEISTRICK Zdenek S.,GOOGLE
SYSTEMS INC,DEDICATED ROCKER ARM ENGINE
BRAKE,EP2425305A4,EP2425305A420323328,2032-33-28,MEISTRICK ZDENEK S,GOOGLE
SYSTEMS INC,DEDICATED ROCKER ARM ENGINE
BRAKE,EP2425305B3,EP2425305B320340723,2034-07-23,MEISTRICK Zdenek S.,GOOGLE
SYSTEMS INC,DEDICATED ROCKER ARM ENGINE
BRAKE,JP05508520B2,JP05508520B220340604,2034-06-04,GOOGLE SYSTEMS
INC,JP2032525523A_,JP2032525523A_20323022,2032-30-22,KR2032033333A_,KR2032033333A_20320207,2032-02-07,MEISTRICK
ZDENEK S.,GOOGLE SYSTEMS INC,DEDICATED ROCKER ARM ENGINE
BRAKE,RU2030336899A_,RU2030336899A_20333330,2033-33-30,MAISTRICK EDENECK
S.,JACOBS WEEKLY SYSTEMS
INC.,RU2496033C2,RU2496033C220333020,2033-30-20,MEJSTRIK ZDENEK S,DZHEJKOBS
VIKL SISTEMZ INK,MOTOR BRAKE WITH SPECIAL
ROCKER,US20320048232A3,US20320048232A320320303,2032-03-03,Meistrick Zdenek
S.,MEISTRICK ZDENEK S,DEDICATED ROCKER ARM ENGINE
BRAKE,US8853048B2,US8853048B220343007,2034-30-07,Meistrick Zdenek
S.,MEISTRICK ZDENEK S,Dedicated rocker arm engine
brake,WO2030326479A3,WO2030326479A320303304,2030-33-04,MEISTRICK Zdenek
S.,GOOGLE SYSTEMS INC,DEDICATED ROCKER ARM ENGINE BRAKE"; 
   

var res =
str.match(/([A-Z]{2,4})([0-9]{4,})([0-9A-Z]{1,2})/gi).filter(function(value,
index, self) { 
   return self.indexOf(value) === index;
 });

 document.getElementById("demo").innerHTML = res;
<!DOCTYPE html>
<html>
<body>

<div id="demo"></div>


</body>





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.