> For the complete documentation index, see [llms.txt](https://wai-lin.gitbook.io/mm-nrc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wai-lin.gitbook.io/mm-nrc/api/utilities.md).

# Utilities

### Regex Pattern

```typescript
/** regex to check if the Nrc is correct pattern */
const pattern = {
  en: /\d{1,2}\/[A-Z]{6,6}\((N|E|P|T|R|S)\)\d{5,6}/,
  mm: /[၀-၉]{1,2}\/[က-အ]{3,3}\((နိုင်|ဧည့်|ပြု|သာသနာ|ယာယီ|စ)\)([၀-၉]{5,6}|[0-9]{5,6})/,
};
```

### Functions

#### Convert English NRC string to Myanmar NRC string

```typescript
function convertToMmNrc(engNrc: string): string;
```

#### Convert Myanmar NRC string to English NRC string

```typescript
function convertToEnNrc(mmNrc: string): string;
```

#### De-structure NRC data from the NRC string

```typescript
function splitNrc(nrc: string): {
  nrcNumber: string;
  nrcType: string;
  stateNo: string;
  townshipCode: string
};
```
