# System veilog Regular expressions

**URL:** <https://verificationacademy.com/forums/t/system-veilog-regular-expressions/33277>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, regular-expressions\
**Created:** [July 6, 2017, 12:14pm UTC](https://verificationacademy.com/forums/t/system-veilog-regular-expressions/33277 "2017-07-06T12:14:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![saritr](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@saritr](https://verificationacademy.com/forums/u/saritr)\
**Post date:** [July 6, 2017, 12:14pm UTC](https://verificationacademy.com/forums/t/system-veilog-regular-expressions/33277/1 "2017-07-06T12:14:07Z")

</div>

I understood that System verilog does not have very good regular expression support inbuilt.

How can I check in systemVerilog that a srting matches to the following regular expressions: “\d+(ns|ps|us)”

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [July 6, 2017, 3:11pm UTC](https://verificationacademy.com/forums/t/system-veilog-regular-expressions/33277/2 "2017-07-06T15:11:00Z")

</div>

_In reply to [saritr](https://verificationacademy.com/forums/t/system-veilog-regular-expressions/33277):_

You have a number of different options.

Some simulators already support a set of SystemVerilog string method extensions that handle regular expressions such as str.match() and str.search().

```verilog
result = str.match(“pattern”); // returns true if the pattern is matched with the str.

```

If you are using the UVM, there is a DPI routine that does the same thing

```verilog
result = uvm_pkg::uvm_re_match(“pattern”,str);

```

There are number of other packages out there such as SVunit that also provide the DPI routines for you.
