const regex = /^(003|004|007|010|011|012|014|015|016|017|018|021|024|025|029|033|036|037|040|041|047|060|062|063|064|065|066|069|070|074|075|076|077|078|079|080|081|082|083|084|085|088|089|091|092|093|094|095|096|097|098|099|100|101|102|104|105|107|108|111|113|114|341|117|119|120|121|122|124|125|126|127|128|129|130|131|132|133|134|136|138|139|140|142|143|144|145|146|149|157|159|163|169|173|174|177|180|183|184|188|189|190|191|194|196|197|208|212|213|217|218|222|224|233|237|241|243|246|249|250|253|254|259|260|265|266|268|269|270|271|272|273|274|276|278|279|280|281|283|285|286|288|289|290|292|293|296|298|299|300|301|306|307|309|310|313|315|318|319|320|321|322|323|324|325|326|329|330|331|332|335|336|340|342|343|348|349|350|352|354|355|359|360|362|363|364|365|366|367|368|370|371|373|374|376|377|378|379|380|381|382|383|384|387|389|390|391|393|394|395|396|397|399|402|403|404|406|408|412|422|456|464|473|477|479|487|488|492|495|505|545|600|604|610|611|612|613|623|626|630|633|634|637|643|652|653|654|655|707|712|739|741|743|745|746|747|748|751|752|753|754|755|756|757|001|000|016|017|018|021|024|025|029|033|036|037|040|041|047|060|062|063|064|065|066|069|070|074|075|076|077|078|079|080|081|082|083|084|085|088|089|091|092|093|094|095|096|097|098|099|100|101|102|104|105|107|108|111|113|114|341|117|119|120|121|122|124|125|126|127|128|129|130|131|132|133|134|136|138|139|140|142|143|144|145|146|149|157|159|163|169|173|174|177|180|183|184|188|189|190|191|194|196|197|208|212|213|217|218|222|224|233|237|241|243|246|249|250|253|254|259|260|265|266|268|269|270|271|272|273|274|276|278|279|280|281|283|285|286|288|289|290|292|293|296|298|299|300|301|306|307|309|310|313|315|318|319|320|321|322|323|324|325|326|329|330|331|332|335|336|340|342|343|348|349|350|352|354|355|359|360|362|363|364|365|366|367|368|370|371|373|374|376|377|378|379|380|381|382|383|384|387|389|390|391|393|394|395|396|397|399|402|403|404|406|408|412|422|456|464|473|477|479|487|488|492|495|505|545|600|604|610|611|612|613|623|626|630|633|634|637|643|652|653|654|655|707|712|739|741|743|745|746|747|748|751|752|753|754|755|756|757|001|000).{4}0.{45}(\d{4}).(\d{12})\w?.{72}(\d{8})/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^(003|004|007|010|011|012|014|015|016|017|018|021|024|025|029|033|036|037|040|041|047|060|062|063|064|065|066|069|070|074|075|076|077|078|079|080|081|082|083|084|085|088|089|091|092|093|094|095|096|097|098|099|100|101|102|104|105|107|108|111|113|114|341|117|119|120|121|122|124|125|126|127|128|129|130|131|132|133|134|136|138|139|140|142|143|144|145|146|149|157|159|163|169|173|174|177|180|183|184|188|189|190|191|194|196|197|208|212|213|217|218|222|224|233|237|241|243|246|249|250|253|254|259|260|265|266|268|269|270|271|272|273|274|276|278|279|280|281|283|285|286|288|289|290|292|293|296|298|299|300|301|306|307|309|310|313|315|318|319|320|321|322|323|324|325|326|329|330|331|332|335|336|340|342|343|348|349|350|352|354|355|359|360|362|363|364|365|366|367|368|370|371|373|374|376|377|378|379|380|381|382|383|384|387|389|390|391|393|394|395|396|397|399|402|403|404|406|408|412|422|456|464|473|477|479|487|488|492|495|505|545|600|604|610|611|612|613|623|626|630|633|634|637|643|652|653|654|655|707|712|739|741|743|745|746|747|748|751|752|753|754|755|756|757|001|000|016|017|018|021|024|025|029|033|036|037|040|041|047|060|062|063|064|065|066|069|070|074|075|076|077|078|079|080|081|082|083|084|085|088|089|091|092|093|094|095|096|097|098|099|100|101|102|104|105|107|108|111|113|114|341|117|119|120|121|122|124|125|126|127|128|129|130|131|132|133|134|136|138|139|140|142|143|144|145|146|149|157|159|163|169|173|174|177|180|183|184|188|189|190|191|194|196|197|208|212|213|217|218|222|224|233|237|241|243|246|249|250|253|254|259|260|265|266|268|269|270|271|272|273|274|276|278|279|280|281|283|285|286|288|289|290|292|293|296|298|299|300|301|306|307|309|310|313|315|318|319|320|321|322|323|324|325|326|329|330|331|332|335|336|340|342|343|348|349|350|352|354|355|359|360|362|363|364|365|366|367|368|370|371|373|374|376|377|378|379|380|381|382|383|384|387|389|390|391|393|394|395|396|397|399|402|403|404|406|408|412|422|456|464|473|477|479|487|488|492|495|505|545|600|604|610|611|612|613|623|626|630|633|634|637|643|652|653|654|655|707|712|739|741|743|745|746|747|748|751|752|753|754|755|756|757|001|000).{4}0.{45}(\\d{4}).(\\d{12})\\w?.{72}(\\d{8})', 'gm')
const str = `23700000 207366109000196000000000000000716060263280000000001279 FACELL COMERCIO DE CELULARES EBRADESCO S/A 20306202106483600041705001600 71606 `;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions