excel - How would I translate this to RegEx? -


i'm having trouble translate regex:

actual file format (for excel spreadsheet):

  • [demo-_file.xls]'sheet_name'!ca
  • [sample file 2.xls]'demo sheet'!d

inside bracket , single quote:

  • accept characters z (regardless of case)
  • accepts special characters -_. , space.

after exclamation mark, should accept 4 capital characters.

here suggestion:

\[[\w\s&.-]*\]'[\w\s&.-]+'![a-z]{1,4} 

in js:

var re = /\[[\w\s&.-]*\]'[\w\s&.-]+'![a-z]{1,4}/gi;  

[\w\s&.-]* match alphanumeric characters , _ spaces, &, . , -. [a-z]{1,4} match 1 4 uppercase english letters. i option make matching case-insensitive. if want allow digits in last part, revert them [a-z0-9]{1,4}.

see demo


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -