using UnityEngine;
using System.Collections;
using System.Text.RegularExpressions;
public class regex : MonoBehaviour
{
public string s = "afsdlk 10 sdfalkj 30";
// Update is called once per frame
void Start()
{
string[] numbers = Regex.Split(s, @"\D+");
foreach (string value in numbers)
{
if (!string.IsNullOrEmpty(value))
{
int i = int.Parse(value);
Debug.Log("Number: " + i);
}
}
}
}
Awesome! This works exactly how I needed it to work, thanks a lot for your help kari :)
– ronronmx