---
title: "regexp"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/106766-regexp"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Frexuz"
published: "2004-07-05T14:33:58.000Z"
updated: "2004-07-05T20:21:59.000Z"
replies: 3
views: 237
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/106766-regexp"
---

# regexp

## #1 — Frexuz, 2004-07-05T14:33Z

vill kolla igenom en sträng om den innehåller 2 eller fler siffror irad och replace'a dom med '' (inget alltså)

och sedan få in den i denna koden efter alla mina andra replace

```
<body bgcolor="#333333" text="#FFFFFF">
<%
Function ProperCase(Value)
    ProperCase = UCase(Left(Value, 1)) & LCase(Mid(Value, 2))
End Function

Dim countOk, countChanged
countOk = + 0
countChanged = 0

Sub ShowFiles(ByRef objFS, ByRef lngFiles, ByRef lngFolders, ByRef lngSize, ByVal strPath)
   ' lokala variabler
   Dim objThisFolder, objFile, objFolder, orgName, tmpName, strName, arrName
   
      ' skapa ett objekt för mappen vi är i
   Set objThisFolder = objFS.GetFolder(strPath)
   ' loopa igenom alla mappar i mappen
   For each objFolder in objThisFolder.SubFolders
      ' visa allt i en undermapp
      Call ShowFiles(objFS, lngFiles, lngFolders, lngSize, strPath & "\" & objFolder.Name)
   Next
   ' loopa igenom alla filer i mappen
   For each objFile in objThisFolder.Files
	  		orgName = objFile.Name
			strName = objFile.Name
			tmpName = "tempMp3Name.mp3"

			strName = Replace(strName, "rmx", "Remix", 1, -1, vbTextCompare)
			strName = Replace(strName, "remix", "Remix")
			strName = Replace(strName, "ft.", "feat.")
			strName = Replace(strName, "featuring", "feat.")
			strName = Replace(strName, "featuring.", "feat.")
			strName = Replace(strName, " And ", "&")
			strName = Replace(strName, " and ", "&")
			strName = Replace(strName, "_", " ")
			strName = Replace(strName, " - ", "-")
			strName = Replace(strName, "-", " - ")
			arrName = Split(strName)
			
			For i = 0 To UBound(arrName)
				arrName(i) = ProperCase(arrName(i))
			Next
			
			strName = Join(arrName)
	
			If orgName = strName Then
				countOk = countOk + 1
			Else
				countChanged = countChanged + 1
				objFile.Name = tmpName
				objFile.Name = strName
				Response.Write "<font face=""verdana"" size=""1"" color=""#EEEEEE"">" & objThisFolder & "\" & orgName & ""
				Response.Write "<font color=""#FF0000""> -> </font><font color=""#EEEEEE"">" & strName & "</font><br>" & vbCrLf
			End If

   Next
   
End Sub

Dim objFS

Set objFS=Server.CreateObject("Scripting.FileSystemObject")
Call ShowFiles(objFS, lngFiles, lngFolders, lngSize, "c:\Mp3")
Set objFS = Nothing

response.write "<font face=""verdana"" size=""1"" color=""#EEEEEE""><b>Done</b></font>"
%>
```

(jag antar att regexp är det bästa sättet?)

Permalänk: https://www.webforum.nu/p/106766

## #2 — Jesper T, 2004-07-05T15:35Z

Detta kanske är ett pattern du kan använda: \\d{3,}

Skall träffa nummeriska tecken som är fler än "två i rad"

Permalänk: https://www.webforum.nu/p/1379430

## #3 — Frexuz, 2004-07-05T16:28Z

själva pattern är nog inte det svåra för mig, utan vad jag ska göra med resultatet typ

Permalänk: https://www.webforum.nu/p/1379454

## #4 — Engine^, 2004-07-05T20:21Z

Du stoppar in följande efter dina replace kanske kan fungera. Det borde stryka allt med mer än en siffra i rad.

```
Set objRX = New RegEx

objRX.Global = True
objRX.Pattern = "\d{2,}"

strName = objRX.Replace(strName, "")
```

Permalänk: https://www.webforum.nu/p/1379549

---

Tråden på webben: https://www.webforum.nu/amne/asp/106766-regexp
