> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/decision/isvalid.md).

# IsValid

Validates the incoming `value` against the given `type`.

If the type is a range, the value is validated against the range. If the type is a pattern, the value is validated against the pattern. If the type is a date, the value is validated against the date format. If the type is a locale date, the value is validated against the locale date format. If the type is a regular expression, the value is validated against the regular expression.

**Note we expressly do not support the \`eurodate\` type, since date formats vary across EU countries. For this, prefer the \`LSIsDate( date, locale )\` method instead.**

## Valid Types

* array
* binary
* boolean
* component
* creditcard
* date
* email
* float
* function
* guid
* hex
* integer
* numeric
* number
* query
* range
* regex
* regular\_expression
* social\_security\_number
* ssn
* string
* struct
* telephone
* time
* time
* url
* usdate
* uuid
* variablename
* xml
* zipcode

## Method Signature

```
IsValid(type=[string], value=[any], min=[any], max=[any], pattern=[any])
```

### Arguments

| Argument  | Type     | Required | Description                                                                               | Default |
| --------- | -------- | -------- | ----------------------------------------------------------------------------------------- | ------- |
| `type`    | `string` | `true`   | The type to validate the value against                                                    |         |
| `value`   | `any`    | `true`   | Value to test for validaty on a given type                                                |         |
| `min`     | `any`    | `false`  | <p>The minimum value for the range type or a pattern to validate<br>the value against</p> |         |
| `max`     | `any`    | `false`  | The maximum value for the range type                                                      |         |
| `pattern` | `any`    | `false`  | The pattern to validate the value against                                                 |         |

## Examples

### Check to see if a 235 is an integer

Use the isValid function with integer as the type.

[Run Example](https://try.boxlang.io/?code=eJzLLA5LzMlM0VBQyswrSU1PLVLSUTAyNlXQtOYCAH0oB7s%3D)

```java
isValid( "integer", 235 );

```

Result: true

### Validate an Email Address

Use the isValid function with email as the type.

[Run Example](https://try.boxlang.io/?code=eJzLLA5LzMlM0VBQSs1NzMxR0lFQKi1OLXJIrUjMLchJ1UvOz1VS0LTmAgAT6QzX)

```java
isValid( "email", "user@example.com" );

```

Result: true

### Additional Examples

```java
<bx:set anArray = [] >
<bx:set boolean = true >
<bx:set email = "test@test.com" >
<bx:set guid = createGUID() >
<bx:set integer = 15 >
<bx:set string = "Hello World" >
<bx:set http_url = "http://www.test.com" >
<bx:set uuid = createUUID() >

<bx:output>
	Array: #isValid( "array", anArray )#<br>
	Boolean: #isValid( "boolean", boolean )#<br>
	Email: #isValid( "email", email )#<br>
	GUID: #isValid( "guid", guid )#<br>
	Integer: #isValid( "integer", integer )#<br>
	String: #isValid( "string", string )#<br>
	URL: #isValid( "url", http_url )#<br>
	UUID: #isValid( "uuid", uuid )#
</bx:output>
```

## Related

* [ArrayIsEmpty](/boxlang-language/reference/built-in-functions/decision/arrayisempty.md)
* [arrayIsEmpty](https://github.com/ortus-boxlang/boxlang-docs/tree/v1.x/boxlang-language/reference/built-in-functions/decision/arrayIsEmpty.md)
* [Attempt](/boxlang-language/reference/built-in-functions/decision/attempt.md)
* [IsArray](/boxlang-language/reference/built-in-functions/decision/isarray.md)
* [IsBinary](/boxlang-language/reference/built-in-functions/decision/isbinary.md)
* [IsBoolean](/boxlang-language/reference/built-in-functions/decision/isboolean.md)
* [IsBoxSet](/boxlang-language/reference/built-in-functions/decision/isboxset.md)
* [IsClosure](/boxlang-language/reference/built-in-functions/decision/isclosure.md)
* [IsCustomFunction](/boxlang-language/reference/built-in-functions/decision/iscustomfunction.md)
* [IsDate](/boxlang-language/reference/built-in-functions/decision/isdate.md)
* [IsDateObject](/boxlang-language/reference/built-in-functions/decision/isdateobject.md)
* [IsDebugMode](/boxlang-language/reference/built-in-functions/decision/isdebugmode.md)
* [IsDefined](/boxlang-language/reference/built-in-functions/decision/isdefined.md)
* [IsEmpty](/boxlang-language/reference/built-in-functions/decision/isempty.md)
* [IsFileObject](/boxlang-language/reference/built-in-functions/decision/isfileobject.md)
* [IsIPv6](/boxlang-language/reference/built-in-functions/decision/isipv6.md)
* [IsJSON](/boxlang-language/reference/built-in-functions/decision/isjson.md)
* [IsLeapYear](/boxlang-language/reference/built-in-functions/decision/isleapyear.md)
* [IsLocalHost](/boxlang-language/reference/built-in-functions/decision/islocalhost.md)
* [IsNull](/boxlang-language/reference/built-in-functions/decision/isnull.md)
* [IsNumeric](/boxlang-language/reference/built-in-functions/decision/isnumeric.md)
* [IsNumericDate](/boxlang-language/reference/built-in-functions/decision/isnumericdate.md)
* [IsObject](/boxlang-language/reference/built-in-functions/decision/isobject.md)
* [IsQuery](/boxlang-language/reference/built-in-functions/decision/isquery.md)
* [IsRange](/boxlang-language/reference/built-in-functions/decision/isrange.md)
* [IsSimpleValue](/boxlang-language/reference/built-in-functions/decision/issimplevalue.md)
* [IsStringBuilder](/boxlang-language/reference/built-in-functions/decision/isstringbuilder.md)
* [IsStruct](/boxlang-language/reference/built-in-functions/decision/isstruct.md)
* [IsXML](/boxlang-language/reference/built-in-functions/decision/isxml.md)
* [IsXmlAttribute](/boxlang-language/reference/built-in-functions/decision/isxmlattribute.md)
* [IsXMLDoc](/boxlang-language/reference/built-in-functions/decision/isxmldoc.md)
* [IsXMLElem](/boxlang-language/reference/built-in-functions/decision/isxmlelem.md)
* [IsXMLNode](/boxlang-language/reference/built-in-functions/decision/isxmlnode.md)
* [IsXMLRoot](/boxlang-language/reference/built-in-functions/decision/isxmlroot.md)
* [LSIsNumeric](/boxlang-language/reference/built-in-functions/decision/lsisnumeric.md)
* [structIsEmpty](/boxlang-language/reference/built-in-functions/decision/structisempty.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/decision/isvalid.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
