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