# if .. elseif

**URL:** https://community.mp3tag.de/t/if-elseif/12883
**Category:** Web Sources Discussion
**Created:** [December 31, 2011, 1:12am UTC](https://community.mp3tag.de/t/if-elseif/12883 "2011-12-31T01:12:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ra7h35m20s](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/779978/32.png) [@ra7h35m20s](https://community.mp3tag.de/u/ra7h35m20s)
#### Post date: [December 31, 2011, 1:12am UTC](https://community.mp3tag.de/t/if-elseif/12883/1 "2011-12-31T01:12:06Z")

</div>

Maybe I am missing something but is there a way to have this functionality in the scripts?

if "this matches"  
do this....  
elseif "this matches"  
do this...  
end if

Looking at the "List of Parser Commands" I do not see a way where the elseif test could be incorporated. If I am missing something or someone knows a trick I would certainly be interested in that info.... thanx!!

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [December 31, 2011, 1:42am UTC](https://community.mp3tag.de/t/if-elseif/12883/2 "2011-12-31T01:42:02Z")

</div>

it's "else" not "elseif", and it's without a second _"this matches"_

From the help page:  
If S Check for occurrence of S on current position.  
IfNot S Check for absence of S on current position.  
Else Else branch of an If operation.  
Endif End of an If/IfNot operation.

from a script of mine:

```
        if "XXX-ALBUMARTIST-XXX"
            sayoutput "albumartist"
        else
            regexpreplace "\s{2,}" " "
            sayrest
        endif

```

or more complicated here:

```
if "-" #one digit
    
else
    movechar 1
    if "-" #two digits
        regexpreplace "-(\d)-" "-0$1-"
    else
        movechar 1
        if "-" #three digits
            regexpreplace "-(\d)-" "-0$1-"
            regexpreplace "-(\d\d)-" "-0$1-"
        else #four digits
            regexpreplace "-(\d)-" "-0$1-"
            regexpreplace "-(\d\d)-" "-0$1-"
            regexpreplace "-(\d\d\d)-" "-0$1-"
        endif
    endif
endif
```
