如何在不使用instr和substr的情况下从电子邮件中提取用户名。我在oracle db中工作。 我试过这个
select regexp_replace(email,'^.*@') from students;
但是我输出了域名.pls帮助
答案 0 :(得分:1)
select regexp_replace(email,'@.*$') from students
它取代了从@
开始直到行尾的所有内容。
答案 1 :(得分:-1)
试试这个
$ComputerNameArray = Get-Content -Path c:\restarted.txt
[int]$SleepTimer = "1" #minutes to attempt after
[int]$Attempts = "2"
$DefaultBackgroundColor = (Get-Host).ui.rawui.BackgroundColor
foreach($ComputerName in $ComputerNameArray) {
$AttemptsCounter = 0
$RemainingAttempts = $Attempts - $AttemptsCounter
Write-Host "Testing to see if ""$ComputerName"" is coming online..." -BackgroundColor $DefaultBackgroundColor
while($RemainingAttempts -gt 0) {
if(Test-Connection -ComputerName $ComputerName -Quiet -Count 1) {
Write-Host """$ComputerName""" -BackgroundColor Green -NoNewline
Write-Host " Is coming online...Skipping to offline one's"
break
} else {
Write-Host """$ComputerName""" -BackgroundColor Red -NoNewline
Write-Host " is Offline" -BackgroundColor Red -ForegroundColor Black -NoNewline
Write-Host ". Pausing for $SleepTimer minutes. Remaining attempts: $($RemainingAttempts - 1)"
Start-Sleep -Seconds ($SleepTimer * 60)
$RemainingAttempts--
}
}
if($RemainingAttempts -eq 0) {
Write-Host "Maximum number of attempts reached" -BackgroundColor $DefaultBackgroundColor
}
}
请注意,此查询假定您的用户名中只包含字符(即@符号前面的字符)并且它是leng
如果您的用户名包含字符和数字的组合,则可以尝试以下代码
select regexp_substr(email, '[A-Z]{1,10}') REG_EXP from students;
注意:如果您使用小写字母,则此脚本可以使用,如果您的用户名超过10个字符,请相应更改{1,10}部分代码