권xx xx에서 권 앞에 띄워쓰기가 아닌 무언가 1개 더 있는 거 같아서 한글만 출력하도록 하고 싶습니다. 그런데 에러가 나오네요. 한글 정규식을 넣기 전에 띄워쓰기 없애고 앞에서 3글자만 나오도록 하니 "권x"까지만 나옵니다. 그래서 한글로만 나오게 하고 싶습니다.
현재 아래까지 했습니다.
System.Text.RegularExpressions.Regex.Replace(TimeTable.Rows(0)(1).ToString, “[^가-힣]+”,String.Empty).Trim.Replace(" “,”").Substring(0,3)
Hi @wjdehdnr456
Give a try with the following
System.Text.RegularExpressions.Regex.Replace(TimeTable.Rows(0)(1).ToString, "[^가-힣]+", String.Empty).Replace(" ", "").Substring(0, 3)
Regards!
1 Like
No, the same error comes out
lrtetala
(Lakshman Reddy)
4
Hi @wjdehdnr456
Can you try the below
New String(System.Text.RegularExpressions.Regex.Replace(TimeTable.Rows(0)(1).ToString(), "[^a-zA-Z]+", "").Trim().Replace(" ", "").Where(Function(c) Char.GetUnicodeCategory(c) = Globalization.UnicodeCategory.OtherLetter).Take(3).ToArray())
Regards,
1 Like
mkankatala
(Mahesh Kankatala)
5
Hi @wjdehdnr456
You can try the below following:
Output = System.Text.RegularExpressions.Regex.Match(TimeTable.Rows(0)(1).ToString, "[가-힣]+").Value.Substring(0, Math.Min(3, System.Text.RegularExpressions.Regex.Match(TimeTable.Rows(0)(1).ToString, "[가-힣]+").Value.Length)).Trim
Output variable is of DataType System.String.
Hope it helps!!
Regards