|
238 | 238 | "@ |
239 | 239 |
|
240 | 240 |
|
| 241 | +###[ Regular Expressions ]##################################################### |
| 242 | + |
| 243 | + 'book' -match 'oo' |
| 244 | +# ^^^^^^ meta.string.powershell string.quoted.single.powershell |
| 245 | +# ^ punctuation.definition.string.begin.powershell |
| 246 | +# ^ punctuation.definition.string.end.powershell |
| 247 | +# ^^^^^^ keyword.operator.logical.powershell |
| 248 | +# ^ punctuation.definition.keyword.powershell |
| 249 | +# ^^^^ meta.string.powershell |
| 250 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 251 | +# ^^ source.regexp.embedded |
| 252 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 253 | + 'big' -match 'b[iou]g' |
| 254 | +# ^^^^^ meta.string.powershell string.quoted.single.powershell |
| 255 | +# ^ punctuation.definition.string.begin.powershell |
| 256 | +# ^ punctuation.definition.string.end.powershell |
| 257 | +# ^^^^^^ keyword.operator.logical.powershell |
| 258 | +# ^ punctuation.definition.keyword.powershell |
| 259 | +# ^^^^^^^^^ meta.string.powershell |
| 260 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 261 | +# ^^^^^^^ source.regexp.embedded |
| 262 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 263 | + 42 -match '[0-9][0-9]' |
| 264 | +# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell |
| 265 | +# ^^^^^^ keyword.operator.logical.powershell |
| 266 | +# ^ punctuation.definition.keyword.powershell |
| 267 | +# ^^^^^^^^^^^^ meta.string.powershell |
| 268 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 269 | +# ^^^^^^^^^^ source.regexp.embedded |
| 270 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 271 | + 'a1\ ' -match '....' |
| 272 | +# ^^^^^^ meta.string.powershell string.quoted.single.powershell |
| 273 | +# ^ punctuation.definition.string.begin.powershell |
| 274 | +# ^ punctuation.definition.string.end.powershell |
| 275 | +# ^^^^^^ keyword.operator.logical.powershell |
| 276 | +# ^ punctuation.definition.keyword.powershell |
| 277 | +# ^^^^^^ meta.string.powershell |
| 278 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 279 | +# ^^^^ source.regexp.embedded keyword.other.any.regexp |
| 280 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 281 | + 'ACCOUNT NAME: Administrator' -match 'ACCOUNT NAME:\s*\w*' |
| 282 | +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell |
| 283 | +# ^ punctuation.definition.string.begin.powershell |
| 284 | +# ^ punctuation.definition.string.end.powershell |
| 285 | +# ^^^^^^ keyword.operator.logical.powershell |
| 286 | +# ^ punctuation.definition.keyword.powershell |
| 287 | +# ^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell |
| 288 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 289 | +# ^^^^^^^^^^^^^^^^^^^ source.regexp.embedded |
| 290 | +# ^^ keyword.control.character-class.regexp |
| 291 | +# ^ keyword.operator.quantifier.regexp |
| 292 | +# ^^ keyword.control.character-class.regexp |
| 293 | +# ^ keyword.operator.quantifier.regexp |
| 294 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 295 | + 'SERVER01' -match '[A-Z]+-?\d\d' |
| 296 | +# ^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell |
| 297 | +# ^ punctuation.definition.string.begin.powershell |
| 298 | +# ^ punctuation.definition.string.end.powershell |
| 299 | +# ^^^^^^ keyword.operator.logical.powershell |
| 300 | +# ^ punctuation.definition.keyword.powershell |
| 301 | +# ^^^^^^^^^^^^^^ meta.string.powershell |
| 302 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 303 | +# ^^^^^^^^^^^^ source.regexp.embedded |
| 304 | +# ^^^^^ meta.set.regexp |
| 305 | +# ^ keyword.operator.quantifier.regexp |
| 306 | +# ^ keyword.operator.quantifier.regexp |
| 307 | +# ^^^^ keyword.control.character-class.regexp |
| 308 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 309 | + '111-222-3333' -match '\d{3}-\d{3}-\d{4}' |
| 310 | +# ^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell |
| 311 | +# ^ punctuation.definition.string.begin.powershell |
| 312 | +# ^ punctuation.definition.string.end.powershell |
| 313 | +# ^^^^^^ keyword.operator.logical.powershell |
| 314 | +# ^ punctuation.definition.keyword.powershell |
| 315 | +# ^^^^^^^^^^^^^^^^^^^ meta.string.powershell |
| 316 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 317 | +# ^^^^^^^^^^^^^^^^^ source.regexp.embedded |
| 318 | +# ^^ keyword.control.character-class.regexp |
| 319 | +# ^^^ keyword.operator.quantifier.regexp |
| 320 | +# ^^ keyword.control.character-class.regexp |
| 321 | +# ^^^ keyword.operator.quantifier.regexp |
| 322 | +# ^^ keyword.control.character-class.regexp |
| 323 | +# ^^^ keyword.operator.quantifier.regexp |
| 324 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 325 | + 'fishing' -match '^fish$' |
| 326 | +# ^^^^^^^^^ meta.string.powershell string.quoted.single.powershell |
| 327 | +# ^ punctuation.definition.string.begin.powershell |
| 328 | +# ^ punctuation.definition.string.end.powershell |
| 329 | +# ^^^^^^ keyword.operator.logical.powershell |
| 330 | +# ^ punctuation.definition.keyword.powershell |
| 331 | +# ^^^^^^^^ meta.string.powershell |
| 332 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 333 | +# ^^^^^^ source.regexp.embedded |
| 334 | +# ^ keyword.control.anchor.regexp |
| 335 | +# ^ keyword.control.anchor.regexp |
| 336 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 337 | + '3.141' -match '3\.\d{2,}' |
| 338 | +# ^^^^^^^ meta.string.powershell string.quoted.single.powershell |
| 339 | +# ^ punctuation.definition.string.begin.powershell |
| 340 | +# ^ punctuation.definition.string.end.powershell |
| 341 | +# ^^^^^^ keyword.operator.logical.powershell |
| 342 | +# ^ punctuation.definition.keyword.powershell |
| 343 | +# ^^^^^^^^^^^ meta.string.powershell |
| 344 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 345 | +# ^^^^^^^^^ source.regexp.embedded meta.mode.basic.regexp |
| 346 | +# ^^ constant.character.escape.regexp |
| 347 | +# ^^ keyword.control.character-class.regexp |
| 348 | +# ^^^^ keyword.operator.quantifier.regexp |
| 349 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 350 | + 'The last logged on user was CONTOSO\jsmith' -match '(.+was )(.+)' |
| 351 | +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell |
| 352 | +# ^ punctuation.definition.string.begin.powershell |
| 353 | +# ^ punctuation.definition.string.end.powershell |
| 354 | +# ^^^^^^ keyword.operator.logical.powershell |
| 355 | +# ^ punctuation.definition.keyword.powershell |
| 356 | +# ^^^^^^^^^^^^^^ meta.string.powershell |
| 357 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 358 | +# ^^^^^^^^^^^^ source.regexp.embedded |
| 359 | +# ^ keyword.other.any.regexp |
| 360 | +# ^ keyword.operator.quantifier.regexp |
| 361 | +# ^ keyword.other.any.regexp |
| 362 | +# ^ keyword.operator.quantifier.regexp |
| 363 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 364 | + $string -match 'was (?<domain>.+)\\(?<user>.+)' |
| 365 | +# ^^^^^^^ variable.other.readwrite.powershell |
| 366 | +# ^ punctuation.definition.variable.powershell |
| 367 | +# ^^^^^^ keyword.operator.logical.powershell |
| 368 | +# ^ punctuation.definition.keyword.powershell |
| 369 | +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell |
| 370 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 371 | +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.regexp.embedded |
| 372 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 373 | + 'Hello World' -replace '(\w+) \w+', '$1 Universe' |
| 374 | +# ^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell |
| 375 | +# ^ punctuation.definition.string.begin.powershell |
| 376 | +# ^ punctuation.definition.string.end.powershell |
| 377 | +# ^^^^^^^^ keyword.operator.string.powershell |
| 378 | +# ^ punctuation.definition.keyword.powershell |
| 379 | +# ^^^^^^^^^^^ meta.string.powershell |
| 380 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 381 | +# ^^^^^^^^^ source.regexp.embedded |
| 382 | +# ^^ keyword.control.character-class.regexp |
| 383 | +# ^ keyword.operator.quantifier.regexp |
| 384 | +# ^^ keyword.control.character-class.regexp |
| 385 | +# ^ keyword.operator.quantifier.regexp |
| 386 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 387 | +# ^ punctuation.separator.sequence.powershell |
| 388 | +# ^^^^^^^^^^^^^ meta.string.powershell |
| 389 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 390 | +# ^^^^^^^^^^^ source.regexp.embedded |
| 391 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 392 | + "Hello World" -replace "(\w+) \w+", "`$1 Universe" |
| 393 | + '5.72' -replace '(.+)', '$$$1' |
| 394 | +# ^^^^^^ meta.string.powershell string.quoted.single.powershell |
| 395 | +# ^ punctuation.definition.string.begin.powershell |
| 396 | +# ^ punctuation.definition.string.end.powershell |
| 397 | +# ^^^^^^^^ keyword.operator.string.powershell |
| 398 | +# ^ punctuation.definition.keyword.powershell |
| 399 | +# ^^^^^^ meta.string.powershell |
| 400 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 401 | +# ^^^^ source.regexp.embedded |
| 402 | +# ^ keyword.other.any.regexp |
| 403 | +# ^ keyword.operator.quantifier.regexp |
| 404 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 405 | +# ^ punctuation.separator.sequence.powershell |
| 406 | +# ^^^^^^ meta.string.powershell |
| 407 | +# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell |
| 408 | +# ^^^^ source.regexp.embedded |
| 409 | +# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell |
| 410 | + "5.72" -replace "(.+)", "`$`$`$1" |
| 411 | + |
241 | 412 | ###[ String Formatting ]####################################################### |
242 | 413 |
|
243 | 414 | "{0:N2}" -f $a |
|
0 commit comments