Ra Patterns Vs. .NET Patterns

This page assumes you are familiar with the .NET regex language Ra's Pattern class inherits the Regex class. More information on regular expressions in .NET Ra's Pattern class works by converting a Ra pattern to a .NET pattern.

Creating a pattern:





Ra Pattern Language -> .NET Regex Language

{open curly} -> \{ {close curly} -> \} {start} -> ^ {end} -> $ {very start} -> \A {before last new line} -> \Z {very end} -> \z {last match end} -> \G {word boundary} -> \b {not word boundary} -> \B {0+} -> * {1+} -> + {0-1} -> ? {4+} -> {4,} {4-8} -> {4,8} {few 0+} -> *? {few 1+} -> +? {few 0-1} -> ?? {few 4+} -> {4,}? {few 4-8} -> {4,8}? {or} -> | {any char} -> . {word char} -> \w {non-word char} -> \W {word} -> (?:\b\w+\b) {ws char} -> \s {non-ws char} -> \S {digit} -> \d {non-digit} -> \D {*:blah} -> (blah) {*name:blah} -> (?<name>blah) {*-name:blah} -> (?<-name>blah) {:blah} -> (?:blah) {any:abc} -> [abc] {none:abc} -> [^abc] {any:a{to}z} -> [a-z] {type:blah} -> \p{blah} {not type:blah} -> \P{blah} {ahead:blah} -> (?=blah) {not ahead:blah} -> (?!blah) {behind:blah} -> (?<=blah) {not behind:blah} -> (?<!blah) {no backtrack:blah} -> (?>blah) {result:2} -> \2 {result:name} -> \k<name> {if:condition{then}stuff{else}other} -> (?(condition)stuff|other) {opt i:blah} -> (?i:blah) {fail} -> (?!)

Replacement Strings (Ra pattern langauge -> .NET regex language)

Use Match.replace instead of Match.result for consistent syntax. $ -> $$ {1} -> $1 {blah} -> ${blah} {*copy match} -> $& {*before match} -> $` {*after match} -> $' {*last captured} -> $+ {*all} -> $_