---
title: isUrl – ฟังก์ชันตรวจสอบว่าเป็น URL ถูกต้องหรือไม่
url: https://www.thepexcel.com/functions/n8n/string-functions/is-url-n8n/
type: function-explainer
program: n8n
syntax: isUrl(value)
date: 2025-12-16
updated: 2025-12-17
scores:
  popularity: 5
  difficulty: 2
  usefulness: 5
---

# isUrl – ฟังก์ชันตรวจสอบว่าเป็น URL ถูกต้องหรือไม่

> ตรวจสอบว่าเป็น URL ที่ถูกต้องหรือไม่

## คำอธิบาย

isUrl ตรวจสอบว่า string เป็น URL ที่ถูกต้องหรือไม่ ฟังก์ชันนี้มีประโยชน์ในการตรวจสอบความถูกต้องของ URL ก่อนการส่งข้อมูลหรือการใช้ในการเรียก API

## Syntax

```excel
isUrl(value)
```

**Variant**

```excel
$json.link.isUrl()
```

ใช้เป็น method เมื่อ $json.link เป็น string

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| value | Yes | string |  | String ที่ต้องการตรวจสอบว่าเป็น URL |

## เคสการใช้งาน

### ตรวจสอบ URL ก่อนเรียก API

ตรวจสอบว่า URL ถูกต้องก่อนใช้ในการเรียก HTTP request

_เหมาะกับ:_ url-validation

### กรอง URL ที่ไม่ถูกต้อง

ลบ URL ที่ไม่ถูกต้องจากรายชื่อ

_เหมาะกับ:_ url-filtering

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: ตรวจสอบ URL ถูกต้อง

```excel
{{ isUrl('https://www.example.com/page') }}
```

**ผลลัพธ์:** `true`

ฟังก์ชันตรวจสอบ 'https://www.example.com/page' เป็น URL ที่ถูกต้อง ผลลัพธ์คือ true

### 2. ตัวอย่างที่ 2: ตรวจสอบ URL ผิด

```excel
{{ isUrl('not a url at all') }}
```

**ผลลัพธ์:** `false`

สูตรนี้ตรวจสอบ 'not a url at all' ไม่ใช่ URL ผลลัพธ์คือ false

### 3. ตัวอย่างที่ 3: ตรวจสอบในเงื่อนไข

```excel
{{ isUrl($json.link) ? 'Valid URL' : 'Invalid URL' }}
```

**ผลลัพธ์:** `Valid URL หรือ Invalid URL`

ตรวจสอบว่า link ถูกต้องแล้วแสดงผล

## หมายเหตุเพิ่มเติม

⚠️ ฟังก์ชัน isUrl() ตรวจสอบเฉพาะ format ของ URL ไม่ได้ยืนยันว่า URL นั้นมีอยู่จริง ใช้ร่วมกับ filter() เพื่อลบ URL ที่ไม่ถูกต้อง

## คำถามที่พบบ่อย

**Q: isUrl() ตรวจสอบ URL format อย่างไร?**

isUrl() ตรวจสอบว่า URL มี protocol (http:// หรือ https://) และโดเมน ตรวจสอบ format ไม่ได้ยืนยันว่า URL มีอยู่จริง

**Q: isUrl() จะรับ relative URLs ได้หรือ?**

ไม่ isUrl() ตรวจสอบ absolute URLs เท่านั้น (ต้องมี protocol)

**Q: ใช้ isUrl() เมื่อไหร่ในการทำงาน?**

ใช้เมื่อต้องการตรวจสอบว่า URL format ถูกต้องก่อนใช้ในการเรียก API หรือนำไปประมวลผล

## ฟังก์ชันที่เกี่ยวข้อง

- [extractUrl – ฟังก์ชันดึง URL จากข้อความ](https://www.thepexcel.com/functions/n8n/string-functions/extract-url-n8n/)
- [isEmail – ฟังก์ชันตรวจสอบว่าเป็น Email ถูกต้องหรือไม่](https://www.thepexcel.com/functions/n8n/string-functions/is-email-n8n/)
- [isDomain – ฟังก์ชันตรวจสอบว่าเป็นโดเมนหรือไม่](https://www.thepexcel.com/functions/n8n/string-functions/is-domain-n8n/)
- [.format() – จัดรูปแบบค่าเป็นสตริงตามรูปแบบที่กำหนด](https://www.thepexcel.com/functions/n8n/math-functions/format-n8n/)

## แหล่งข้อมูลเพิ่มเติม

- [n8n Expressions: isUrl](https://docs.n8n.io/code/expressions/) _(documentation)_
- [URL Validation Guide](https://docs.n8n.io/code/builtin/overview/) _(guide)_

---

_Source: [https://www.thepexcel.com/functions/n8n/string-functions/is-url-n8n/](https://www.thepexcel.com/functions/n8n/string-functions/is-url-n8n/)_
