# 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/blob/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)
* [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)
* [IsSimpleValue](/boxlang-language/reference/built-in-functions/decision/issimplevalue.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: 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 current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
