Skip to content

Commit

Permalink
escape dots in regexps
Browse files Browse the repository at this point in the history
  • Loading branch information
sappelhoff authored and rwblair committed Jul 14, 2022
1 parent c1a618f commit 24d4351
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 74 deletions.
12 changes: 6 additions & 6 deletions bids-validator/bids_validator/rules/file_level_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@
},

"meg": {
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?meg[\\/\\\\]\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:_split-[0-9]+)?(_digitizer.txt|_meg(@@@_meg_type_@@@[\\/\\\\](.(?!\\.(sqd|con|fif|raw|raw\\.mhd|trg|kdf|chn)$))*|[\\/\\\\](.(?!\\.(sqd|con|fif|raw|raw\\.mhd|trg|kdf|chn)$))*)|(@@@_meg_ext_@@@)|(?:_recording-[a-zA-Z0-9]+)?(?:@@@_cont_ext_@@@))$",
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?meg[\\/\\\\]\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:_split-[0-9]+)?(_digitizer\\.txt|_meg(@@@_meg_type_@@@[\\/\\\\](.(?!\\.(sqd|con|fif|raw|raw\\.mhd|trg|kdf|chn)$))*|[\\/\\\\](.(?!\\.(sqd|con|fif|raw|raw\\.mhd|trg|kdf|chn)$))*)|(@@@_meg_ext_@@@)|(?:_recording-[a-zA-Z0-9]+)?(?:@@@_cont_ext_@@@))$",
"tokens": {
"@@@_meg_type_@@@": [
"\\.ds[\\/\\\\].*",
Expand Down Expand Up @@ -565,11 +565,11 @@
"_SPIM"
],
"@@@_microscopy_ext_@@@": [
".ome\\.tif",
".ome\\.btf",
".ome\\.zarr[\\/\\\\].*",
".tif",
".png"
"\\.ome\\.tif",
"\\.ome\\.btf",
"\\.ome\\.zarr[\\/\\\\].*",
"\\.tif",
"\\.png"
]
}
},
Expand Down
108 changes: 54 additions & 54 deletions bids-validator/bids_validator/rules/session_level_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
"scans": {
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(@@@_scat_ext_@@@)$",
"tokens": {
"@@@_scat_ext_@@@": ["_scans.tsv", "_scans.json"]
"@@@_scat_ext_@@@": ["_scans\\.tsv", "_scans\\.json"]
}
},

"func_ses": {
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?task-[a-zA-Z0-9]+(?:_acq-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_echo-[0-9]+)?(@@@_func_ses_ext_@@@)$",
"tokens": {
"@@@_func_ses_ext_@@@": [
"_bold.json",
"_sbref.json",
"_events.json",
"_events.tsv",
"_physio.json",
"_stim.json"
"_bold\\.json",
"_sbref\\.json",
"_events\\.json",
"_events\\.tsv",
"_physio\\.json",
"_stim\\.json"
]
}
},
Expand All @@ -24,23 +24,23 @@
"regexp": "^\\/(sub-[a-zA-Z0-9]+)\\/(?:(ses-[a-zA-Z0-9]+)\\/)?\\1(_\\2)?(?:_acq-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(@@@_asl_ses_ext_@@@)$",
"tokens": {
"@@@_asl_ses_ext_@@@": [
"_asl.json",
"_aslcontext.tsv",
"_m0scan.json",
"_asllabeling.jpg"
"_asl\\.json",
"_aslcontext\\.tsv",
"_m0scan\\.json",
"_asllabeling\\.jpg"
]
}
},

"pet_ses": {
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(?:_trc-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_task-[a-zA-Z0-9]+)?(?:_run-[0-9]+_)?(@@@_pet_ses_type_@@@)$",
"tokens": {
"@@@_pet_ses_type_@@@": ["_pet.json", "_events.json", "_events.tsv"]
"@@@_pet_ses_type_@@@": ["_pet\\.json", "_events\\.json", "_events\\.tsv"]
}
},

"anat_ses": {
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(?:_acq-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_run-[0-9]+_)?(@@@_anat_ses_type_@@@).json$",
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(?:_acq-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_run-[0-9]+_)?(@@@_anat_ses_type_@@@)\\.json$",
"tokens": {
"@@@_anat_ses_type_@@@": [
"T1w",
Expand All @@ -61,7 +61,7 @@
},

"dwi_ses": {
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(?:_acq-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_)?dwi.(?:@@@_dwi_ses_ext_@@@)$",
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(?:_acq-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_)?dwi\\.(?:@@@_dwi_ses_ext_@@@)$",
"tokens": {
"@@@_dwi_ses_ext_@@@": ["json", "bval", "bvec"]
}
Expand All @@ -71,15 +71,15 @@
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(@@@_meg_ses_type_@@@)$",
"tokens": {
"@@@_meg_ses_type_@@@": [
"_events.tsv",
"_channels.tsv",
"_channels.json",
"_meg.json",
"_coordsystem.json",
"_photo.jpg",
"_events\\.tsv",
"_channels\\.tsv",
"_channels\\.json",
"_meg\\.json",
"_coordsystem\\.json",
"_photo\\.jpg",
"_photo\\.png",
"_photo\\.tif",
"_headshape.pos"
"_headshape\\.pos"
]
}
},
Expand All @@ -88,14 +88,14 @@
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:_space-(@@@_eeg_space_@@@))?(@@@_eeg_ses_type_@@@)$",
"tokens": {
"@@@_eeg_ses_type_@@@": [
"_events.tsv",
"_channels.tsv",
"_channels.json",
"_electrodes.tsv",
"_electrodes.json",
"_eeg.json",
"_coordsystem.json",
"_photo.jpg",
"_events\\.tsv",
"_channels\\.tsv",
"_channels\\.json",
"_electrodes\\.tsv",
"_electrodes\\.json",
"_eeg\\.json",
"_coordsystem\\.json",
"_photo\\.jpg",
"_photo\\.png",
"_photo\\.tif"
],
Expand Down Expand Up @@ -153,14 +153,14 @@
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:_space-(@@@_ieeg_space_@@@))?(@@@_ieeg_ses_type_@@@)$",
"tokens": {
"@@@_ieeg_ses_type_@@@": [
"_events.tsv",
"_channels.tsv",
"_channels.json",
"_electrodes.tsv",
"_electrodes.json",
"_ieeg.json",
"_coordsystem.json",
"_photo.jpg",
"_events\\.tsv",
"_channels\\.tsv",
"_channels\\.json",
"_electrodes\\.tsv",
"_electrodes\\.json",
"_ieeg\\.json",
"_coordsystem\\.json",
"_photo\\.jpg",
"_photo\\.png",
"_photo\\.tif"
],
Expand Down Expand Up @@ -226,23 +226,23 @@
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(?:_sample-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_stain-[a-zA-Z0-9]+)?(?:_run-[0-9]+_)?(?:_chunk-[0-9]+)?(@@@_microscopy_ses_type_@@@)$",
"tokens": {
"@@@_microscopy_ses_type_@@@": [
"_TEM.json",
"_SEM.json",
"_uCT.json",
"_BF.json",
"_DF.json",
"_PC.json",
"_DIC.json",
"_FLUO.json",
"_CONF.json",
"_PLI.json",
"_CARS.json",
"_2PE.json",
"_MPE.json",
"_SR.json",
"_NLO.json",
"_OCT.json",
"_SPIM.json"
"_TEM\\.json",
"_SEM\\.json",
"_uCT\\.json",
"_BF\\.json",
"_DF\\.json",
"_PC\\.json",
"_DIC\\.json",
"_FLUO\\.json",
"_CONF\\.json",
"_PLI\\.json",
"_CARS\\.json",
"_2PE\\.json",
"_MPE\\.json",
"_SR\\.json",
"_NLO\\.json",
"_OCT\\.json",
"_SPIM\\.json"
]
}
}
Expand Down
28 changes: 14 additions & 14 deletions bids-validator/bids_validator/rules/top_level_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
"tokens": {
"@@@_root_files_@@@": [
"README",
"README.md",
"README.rst",
"README.txt",
"README\\.md",
"README\\.rst",
"README\\.txt",
"CHANGES",
"LICENSE",
"dataset_description.json",
"genetic_info.json",
"participants.tsv",
"participants.json",
"dataset_description\\.json",
"genetic_info\\.json",
"participants\\.tsv",
"participants\\.json",
"phasediff.json",
"phase1.json",
"phase2.json",
"fieldmap.json",
"events.json",
"scans.json",
"samples.json",
"samples.tsv"
"phase1\\.json",
"phase2\\.json",
"fieldmap\\.json",
"events\\.json",
"scans\\.json",
"samples\\.json",
"samples\\.tsv"
]
}
},
Expand Down

0 comments on commit 24d4351

Please sign in to comment.